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.
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
# 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
/events\.mail\.mydomain\.com/ OK
/mydomain\.com/ OK
/etc/postfix# cat virtual_alias
info@mydomain.com contact@mydomain.com
administrator@mydomain.com root@mydomain.com
/etc/postfix# cat virtual_gids
/.*@events\.mail\.mydomain\.com/ 500
/.*@mydomain\.com/ 500
/etc/postfix# cat virtual_uids
/root@mydomain\.com/ 0
/.*@events\.mail\.mydomain\.com/ 5000
/liferay@mydomain\.com/ 5000
/etc/postfix# cat vmailbox
/.*@events\.mail\.mydomain\.com/ liferay
/liferay@mydomain\.com/ liferay
/root@mydomain\.com/ root


