Introduction #

This article is about setting up your SMTP server in Liferay. The example is done using a 3rd-party email account. For example, you can use your gmail account to send all notifications that come from your Liferay instance. This includes notifications from blog comments, message boards, and account registration emails.

Graphical User Interface #

In Liferay 6 and Liferay 5.2.x, you can configure the SMTP server by going to Control Panel -> Server Administration -> Mail.

Fill out the SMTP fields with your information: we will use gmail for simplicity. This is actually an easy and reliable way to run your SMTP server.

SMTP Server: smtp.gmail.com
Port: 465
[x] Use Secure Connection  << check the box
User: Your gmail username
Password: Your gmail password 

This will give you a working SMTP server!

Legacy #

In older Liferay versions, there was no Liferay GUI. You had to set this based on your app server.

Apache Tomcat #

This section shows how to configure the SMTP server with an email address in Apache Tomcat.

In the file: $LP/conf/Catalina/localhost/ROOT.xml

<!-- Mail -->

<Resource name="mail/MailSession" auth="Container" type="javax.mail.Session" mail.imap.host="localhost" mail.pop3.host="localhost" mail.smtp.host="localhost" mail.store.protocol="imap" mail.transport.protocol="smtp" />}}}

If you are using a Gmail account you should do the following:

<Resource
name="mail/MailSession"
auth="Container"
type="javax.mail.Session"
mail.imap.host="localhost"
mail.pop.host="localhost"
mail.store.protocol="imap"
mail.transport.protocol="smtp"
mail.smtp.host="smtp.gmail.com"
mail.smtp.port="465"
mail.smtp.auth="true"
mail.smtp.starttls.enable="true"
mail.smtp.user="username"
password="password"
mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory"
/>
0 Attachments
18021 Views
Average (2 Votes)
Comments

Showing 4 Comments

Javier Beringola
12/28/08 9:06 AM

Supongo que cuando la cuenta no es gmail también habrá que especificar el nombre de usuario y contraseña para poder entrar en el servidor y envíe el correo.

Joe Veliyath
6/29/11 1:42 AM

Hi Guys, I am a having a peculiar problem.I was trying out TABS of JQUERY in liferay. I build a new portlet to get this functionality. The good news was that the TABS worked when i added the portlet.But When i refresh the page,its not working. Why is that happening ?

P.S I have used the same example as in JQUERY tabs DEMO.

Jakub Liska
11/18/11 5:15 PM

Notice that if you are setting this up in portal-ext.properties instead of server administration, you must use secure smtp protocol : smtps . It is necessary for it to work with gmail.

mail.session.mail.smtp.auth=true
mail.session.mail.smtp.host=smtp.gmail.com­
mail.session.mail.smtp.password=
mail.session.mail.smtp.port=465
mail.session.mail­.smtp.user=
mail.session.mail.transport.protocol=smtps

Jakub Liska
11/20/11 9:36 AM

Ouch, I pasted the example how it shouldn't look like by accident, this is correct :

mail.session.mail.smtps.auth=true
mail.session.mail.smtps.host=smtp.gmail.com
mail­.session.mail.smtps.password=
mail.session.mail.smtps.port=465
mail.session.mail.s­mtps.user=user@gmail.com
mail.session.mail.transport.protocol=smtps