« Voltar para 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 Anexos
75425 Visualizações
Média (3 Votos)
A média da avaliação é 2.0 estrelas de 5.
Comentários
Respostas do tópico Autor Data
Hi Amos, 3 questions about your post : 1) I... Nicolas G. 15 de Abril de 2009 03:21
I could do with some help with this as well,... Hamish Campbell 20 de Junho de 2009 14:23
I am also trying to setup mail notification... Deepak Sharma 18 de Outubro de 2009 12:05
Need full settings in Java Mail (using GMail as... Jonas Yuan 7 de Novembro de 2009 08:10
Hi Jonas, I read your reply to this bug. Does... Rice Owl 11 de Dezembro de 2009 20:40
Correction: I'm using MailServiceUtil class,... Rice Owl 11 de Dezembro de 2009 20:45
The Liferay 6 way seems not to work with TLS... Reinaldo Silva 3 de Dezembro de 2010 17:54
I'm still getting the ... Brian Scott Schupbach 2 de Maio de 2011 12:31
HI. Did you make some other changes in the... Erick Rosales 27 de Junho de 2014 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
Postado em 15/04/09 03: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.
Postado em 20/06/09 14:23 em resposta a 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
Postado em 18/10/09 12:05 em resposta a 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
Postado em 07/11/09 08:10 em resposta a 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.
Postado em 11/12/09 20:40 em resposta a Jonas Yuan.
Correction: I'm using MailServiceUtil class, not MailEngine
Postado em 11/12/09 20:45 em resposta a 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"
Postado em 03/12/10 17: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
Postado em 02/05/11 12:31 em resposta a 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.
Postado em 27/06/14 10:49 em resposta a Reinaldo Silva.