
Mail Integration
This is an article on the entire Liferay mail system. For a quick setup guide for sending email notifications, see SMTP Setup.
Introduction #
There are two parts involved in configuring a mail system integrated with Liferay:
- Install the mail server itself. (Or choose to use a 3rd party mail server)
- Configure Liferay to be able to read and send emails..
Prerequisite #
Setting up Liferay mail requires that you've installed an SMTP server and an IMAP server. If you do not want to set up your own servers, you can alternatively use 3rd party servers (e.g. a gmail account).
Configuration #
Liferay 6 #
In Liferay 6, all mail configurations need to be set through the GUI. You can do this by going to Control Panel -> Server Administration -> Mail. For an SMTP example, see SMTP Setup.
Liferay v5.2 and later #
Liferay v5.2 has unified the configuration of JavaMail so that it's the same for all application servers. Note it can be configured through portal(-ext).properties using the following properties:
mail.session.mail.imap.host=localhost mail.session.mail.pop3.host=localhost mail.session.mail.smtp.host=localhost #mail.session.mail.smtp.password= #mail.session.mail.smtp.user= mail.session.mail.store.protocol=localhost mail.session.mail.transport.protocol=smtp
Previous versions #
It's easy, just configure JavaMail in your app. server to be able to find the SMTP and IMAP servers. It is the same for Linux and Windows. Just follow the documentation.
Read here for more details: Mail (JavaMail) Setup For External .WAR Portlets
If you wish to have your app server manage the JavaMail connection information, but you are on Liferay 5.2 and later, you may add the following to your ext-spring.xml:
<bean id="mailSession" class="com.liferay.portal.spring.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="mail/MailSession" /> </bean>
Troubleshooting #
Want to send mails but you see nothing outgoing? Liferay send email asynchronously. That means various portlets dump emails into a local queue (at least on the JBoss build), which is then worked off towards the mailserver. You can get some insight by setting the Log4j category com.liferay.util.mail to DEBUG, then run whatever should send a mail,then have a look at the logfile (server.log for JBoss).
If you experience Liferay does send email upon account creation but does not send password reset links, ensure that the user interface has both options ticked:
- Allow users to request forgotten passwords?
- Allow users to request password reset links?
It seems the password reset link requires the request forgotten password option - and if not set there is no message, neither in the logfile nor the UI.