« 返回到 Installation

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:

  1. Install the mail server itself. (Or choose to use a 3rd party mail server)
  2. 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.

0 附件
103745 查看
平均 (3 票)
满分为 5,平均得分为 2.0。
评论
讨论主题回复 作者 日期
Hi Amos, 3 questions about your post : 1) I... Nicolas G. 2009年4月15日 上午3:21
I could do with some help with this as well,... Hamish Campbell 2009年6月20日 下午2:23
I am also trying to setup mail notification... Deepak Sharma 2009年10月18日 下午12:05
Need full settings in Java Mail (using GMail as... Jonas Yuan 2009年11月7日 上午8:10
Hi Jonas, I read your reply to this bug. Does... Rice Owl 2009年12月11日 下午8:40
Correction: I'm using MailServiceUtil class,... Rice Owl 2009年12月11日 下午8:45
The Liferay 6 way seems not to work with TLS... Reinaldo Silva 2010年12月3日 下午5:54
I'm still getting the ... Brian Scott Schupbach 2011年5月2日 下午12:31
HI. Did you make some other changes in the... Erick Rosales 2014年6月27日 上午10:49

Hi Amos,

3 questions about your post :

1) I am using Liferay 5.2.3 (trunk rev 29840): I noticed that new users don't receive notifications anymore with this version. Does that mean that now portal-ext.properties needs to be changed for having new users being notified by default ?

2) Which Mail Domain need I to indicate under Control Panel / Setting / General for having JavaMail sending a notification (as before = Liferay 5.1.2)?

3) What is the purpose of the "Mail Host Names" section under the Control Panel / Settings ? Do I need to configure it now for having my users notified now ? Any documentation on that section ?

Please let me know,
Regards,
Nico
在 09-4-15 上午3:21 发帖。
I could do with some help with this as well, have tried to configure it for http://visionontv.org but it dosent work. We are using Gmail as mail provider.
在 09-6-20 下午2:23 发帖以回复 Nicolas G.
I am also trying to setup mail notification mechanism for liferay portal but its not working.
Also I dont see any logs or error message.I am a beginer anb its really confusing and frustrating to not find any solution after lot of research.

Here is my configuration in portal-ext.properties

mail.session.mail.smtp.auth=true
mail.session.mail.smtp.host=smtp.gmail.com
mail.session.mail.smtp.password=password
mail.session.mail.smtp.port=465
mail.session.mail.smtp.user=username
mail.session.mail.smtp.starttls.enable=true
mail.session.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
mail.session.mail.store.protocol=pop3
mail.session.mail.transport.protocol=smtp

Is there anything else to do? Also there is confusion on ControlPanel-->Settings --> mail domain and virtual host.
what should be the values for mail domain and virtual host??

Thanks,
DS
在 09-10-18 下午12:05 发帖以回复 Hamish Campbell
Need full settings in Java Mail (using GMail as an example) like:

mail.session.mail.pop3.host=pop.gmail.com
mail.session.mail.pop3.password=
ma­il.session.mail.pop3.port=110
mail.session.mail.pop3.user=
mail.session.mail.imap.­host=imap.gmail.com
mail.session.mail.imap.port=993
mail.session.mail.store.protoc­ol=imap
mail.session.mail.transport.protocol=smtp
mail.session.mail.smtp.host=smtp.gmail.com
mail.session.mail.smtp.password=password
mail.session.mail.smtp.user=user
mail.session.mail.smtp.port=465
mail.session.mail.smtp.auth=true
mail.session.mail.smtp.starttls.enable=true
mail.session.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory

http://­issues.liferay.com/browse/LPS-5466
在 09-11-7 上午8:10 发帖以回复 Deepak Sharma
Hi Jonas,

I read your reply to this bug. Does this bug cover a problem with MailEngine sending emails out? I don't seem to have problems with LifeRay sending create account emails or forgot password emails, but I have some code that uses the MailEngine.

Previous, I was using localhost (my own mail server) to send emails, but decided to go with RackSpace email hosting. I've been going nuts over it not working properly. One note - it does work for forgot password functionality, but it isn't working for my own portlet that uses the LifeRay MailEngine class. It doesn't error out, no apparent problems, except that it never does send the email.

In addition, I've updated the context.xml file, server.xml file, ext-spring.xml.. just about everything i could think of. Any tips? And previously, when I was using localhost as my mail server, it all did work fine. Seems like the problem is with trying to use the RackSpace email hosting. And I did verify accounts and passwords of course.
在 09-12-11 下午8:40 发帖以回复 Jonas Yuan
Correction: I'm using MailServiceUtil class, not MailEngine
在 09-12-11 下午8:45 发帖以回复 Rice Owl
The Liferay 6 way seems not to work with TLS over plain text authentication. The log show the following error:

ERROR [MailEngine:154] javax.net.ssl.exception: Unrecognized ssl message, plaintext connection?

To make it work I had to return to the portal-ext.properties style and specify all properties, with special attention to include:

mail.smtp.starttls.enable=true

And exclude (or comment);

#mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory"
在 10-12-3 下午5:54 发帖。
I'm still getting the

javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

error. Here are my settings..does anyone see anything? I'm using version 6.0.6

mail.session.mail.pop3.host=****
mail.session.mail.pop3.password=****
ma­il.s­ession.mail.pop3.port=110
mail.session.mail.pop3.user=****
mail.session.mail.imap.­­host=****
mail.session.mail.imap.port=993
mail.session.mail.store.protoc­ol=imap
m­ail.session.mail.transport.protocol=smtp
mail.session.mail.smtp.host=****
mail.ses­sion.mail.smtp.password=****
mail.session.mail.smtp.user=****
mail.session.mail.sm­tp.port=25
mail.session.mail.smtp.auth=true
mail.session.mail.smtp.starttls.enable­=true
#mail.session.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
在 11-5-2 下午12:31 发帖以回复 Reinaldo Silva
HI. Did you make some other changes in the Control Panel in order to get it work? Or the parameters in Control Panel > Mail are ignored with this configuration?

Thanks in advance for your advice.
在 14-6-27 上午10:49 发帖以回复 Reinaldo Silva