Message Boards - post replys from your email client

My goal here will be to explain influence of pop.server.subdomain setting to setup external email server and enable Liferay 6.1 Message Boards to process email replies and post them to correct MessageBoards thread. For me, this feature is extremly handy because I can post to MessageBoards from my smart phone without need to sign in to portal.

Basic configuration requires just an dedicated email account for Liferay Portal. More advanced configuration requires:

  • have command line access to your email server
  • have available domain
  • access to domain register tools to create MX record and new domain aliases.

STEP 1 - Set your company data

First you will need to set your company host and mx record. You do next:

  • Go to Control Panel, Portal Settings - Set company domain to mydomain.com
  • Set email domain to mail.mydomain.com
  • Set liferay user email (eg. liferay@mydomain.com)
  • Go to server administration and click Email tab
  • According to this article (Step 2)  set Incoming and Outgoing email server data

STEP 2 - Change portal-ext

This settings in portal-ext will allow us notifications and will discard email subdomain settings:

pop.server.notifications.enabled=true
pop.server.notifications.interval=1
pop.server.subdomain=

In this point you have basic configuration setup. Liferay will process replys and according to message subject your replys will be posted to right thread.

If you leave default subdomain setting:

pop.server.subdomain=event

or override it with some your value:
pop.server.subdomain=mboards

You will need to setup your email server to correctly process (forward) replys to liferay email account.

pop.server.subdomain=events will cause that liferay builds Message Boards email notifications to have reply-to attribute like mb_message.NNNNN.NNNNN@ events.mydomain.com.  If your email server is not setup to handle emails to events.mydomain.com domain, replys will be rejected from destination email server with an error: The error that the other server returned was: 550 550 5.1.1 <mb_message.12204.12405@events.mydomain.com>: Recipient address rejected: User unknown in virtual mailbox table (state 14). If you set pop.server.subdomain property to empty string, portal would turnoff this feature. In that case reply-to email attribute would be set to email address set in your portal preferencies settings.

STEP 4 - Setup Email Subdomains

To make use of subdomains funcionality we will configure our email server to use virtual email inbox. That is needed bacause Liferay Portal will compose email notification messages such way that you will be replying your emails to generic unexisting users that will be later decoded to correct message boards threads. To achive that our users will be virtual and configured with regular expressions.

Use your domain admin tools to define mx record for mydomain.com and its aliases. In my case I have:

  • mail.mydomain.com as main mx record and
  • events.mail.mydomain.com as alias

Following postfix server setup example is done with dedicated postfix email server installed at Ubuntu OS with dovecot as POP3 server. Note that you might tune dovecot also.

At your email server host create user we will use to handle virtual inbox:

adduser --uid 500 --disabled-password --disabled-login vmail

Now change postfix main.cf to use virtual domains:
Line with  mydestination setting must be commented out and we are adding new lines:
# mydestinations = mydomain.com
myhostname= mail.mydomain.com
mydomain = mydomain.com
# Virtual mailbox settings
virtual_mailbox_domains = events.mail.mydomain.com,  mydomain.com
virtual_mailbox_base = /var/mail
virtual_mailbox_maps = pcre:/etc/postfix/vmailbox
virtual_minimum_uid = 100
virtual_uid_maps = pcre:/etc/postfix/virtual_uids
virtual_gid_maps = pcre:/etc/postfix/virtual_gids
virtual_alias_maps = hash:/etc/postfix/virtual_alias
virtual_mailbox_limit = 0
virtual_transport = virtual
 
local_transport = local
local_recipient_maps = $alias_maps $virtual_mailbox_maps unix:passwd.byname

Create files we will use to configure virtual domains and users. We already refer to those files in main.cf so without them postfix won't be able to startup:

/etc/postfix# cat vdomains
add those lines to file and save:
/events\.mail\.mydomain\.com/ OK
/mydomain\.com/ OK
 
/etc/postfix# cat virtual_alias
add those lines to file and save:
info@mydomain.com contact@mydomain.com
administrator@mydomain.com root@mydomain.com
 
/etc/postfix# cat virtual_gids
add those lines to file and save:
/.*@events\.mail\.mydomain\.com/ 500
/.*@mydomain\.com/ 500
 
/etc/postfix# cat virtual_uids
add those lines to file and save:
/root@mydomain\.com/ 0
/.*@events\.mail\.mydomain\.com/ 5000
/liferay@mydomain\.com/ 5000
 
/etc/postfix# cat vmailbox
add those lines to file and save:
/.*@events\.mail\.mydomain\.com/ liferay
/liferay@mydomain\.com/ liferay
/root@mydomain\.com/ root 

 

Blogs
Techniques are flabbergast I meant,it provides me the prior support to make and follow links mean while.
I agree... But all complexity is at email server side. At my first attempt to do it my self I stacked and asked help of common "linux" guy, he stacked also since he didn't understand what we wanted to do. At the end an linux/network expert did configuration with comment that those are the basics.
Also I'm not sure can this be done in other email servers and is it little bit easier emoticon
When making the mailing list active for a Message Boards Category, replies from both the user's email and the mailing list is not being posted back in the Message Boards Category and the following error/exceptions appear.

01:33:39,050 ERROR [liferay/message_boards_mailing_list-1][ParallelDestination:74] Unable to process message {destinationName=liferay/message_boards_mailing_list, response=null, responseDestinationName=null, responseId=null, payload=com.liferay.portlet.messageboards.messaging.MailingListRequest@6e43219c, values={groupId=0, JOB_NAME=liferay/message_boards_mailing_list/2594620, EXCEPTIONS_MAX_SIZE=0, GROUP_NAME=liferay/message_boards_mailing_list/2594620, DESTINATION_NAME=liferay/message_boards_mailing_list, JOB_STATE=com.liferay.portal.kernel.scheduler.JobState@7953c151, companyId=0}}
com.liferay.portal.kernel.messaging.MessageListenerException: javax.mail.MessagingException: Connect failed;
nested exception is:
java.net.ConnectException: Connection refused
at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:32)
at com.liferay.portal.kernel.scheduler.messaging.SchedulerEventMessageListenerWrapper.receive(SchedulerEventMessageListenerWrapper.java:75)
at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:72)
at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:71)
at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:682)
at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:593)
at java.lang.Thread.run(Thread.java:722)
Caused by: javax.mail.MessagingException: Connect failed;
nested exception is:
java.net.ConnectException: Connection refused
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:210)
at javax.mail.Service.connect(Service.java:295)
at javax.mail.Service.connect(Service.java:176)
at javax.mail.Service.connect(Service.java:125)
at com.liferay.portlet.messageboards.messaging.MailingListMessageListener.doReceive(MailingListMessageListener.java:77)
at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:26)
... 6 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:337)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:198)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
at java.net.Socket.connect(Socket.java:579)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:607)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:160)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:319)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:207)
at com.sun.mail.pop3.Protocol.<init>(Protocol.java:111)
at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:261)
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:206)
... 11 more
Setup a valid mailing list (I used Google Groups)
1)Created a Blank Site, add a page, and add the Message Boards Portlet
2)Create a user, with a valid email address that is a part of the mailing list, and add the user to the site created at Step 2 (this will be the User Email)
3)In the Message Boards Portlet, click on Configuration > Email From and populate another valid email address (this will be the Server Email)
4)Add a Category, check the 'Active' checkbox forthe Mailing List and populate the necessary fields (I used the Server Email for the incoming/outcoming user)
5)Post a thread in the Category and assert the message is received in both the User's email and the Mailing List
Reply back in the user's email, the response is NOT displayed in the Message Boards portlet


Can youplease help me to resolve the issue
Hi Jain, I think you haven't properly configured connection to your email server (socket errors from your stack trace). Honestly I have no any advice for you how to troubleshot it quickly. If I'm you, I would first check manually inbox of your liferay dedicated email address to see if replies arrived at inbox. If yes, than figure out what is wrong with connection settings.
Also, asking questions of this type is much better at forums under proper category as you would get much more attention. Here - it is only me emoticon