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
140112 Views
Average (3 Votes)
The average rating is 4.33333333333333 stars out of 5.