Liferay DXP uses a mail server and SMTP to email notifications. Liferay DXP’s built-in mail session is the easiest way to configure mail and it’s recommended. You can configure the built-in mail session before or after deploying Liferay DXP. Alternatively, you can configure Liferay DXP to use a mail session on the application server.
Creating a mail session in Liferay DXP or on the application server requires this information:
- Incoming POP Server and port
- POP User Name
- POP Password
- Outgoing SMTP Server and port
- SMTP User Name
- SMTP Password
- All JavaMail properties you want to use
Built-in mail session setup is recommended and easiest.
Configuring Liferay DXP’s Built-in Mail Session
The built-in mail session setup can be done using either of these methods:
-
Control Panel
-
Portal properties
Built-in Mail Session in the Control Panel
After deploying Liferay DXP, you can configure the mail session from the Control Panel.
-
Sign in as the administrative user (the user you specified on the Basic Configuration page).
-
Navigate to Control Panel → Configuration → Server Administration → Mail.
-
Fill out the form. You’re asked for the following information:
Incoming POP Server: The hostname for a server running the Post Office Protocol. Liferay DXP checks this mailbox for incoming messages, such as message board replies.
Incoming Port: The port on which the POP server is listening.
Use a Secure Network Connection: Use an encrypted connection when connecting to the POP server.
User Name: The user ID Liferay DXP should use to log into the POP server.
Password: The password Liferay DXP should use to log into the POP server.
Outgoing SMTP Server: The hostname for a server running the Simple Mail Transfer Protocol. Liferay DXP uses this server to send emails, such as password change emails and other notifications.
Outgoing Port: The port on which the SMTP server is listening.
Use a Secure Network Connection: Use an encrypted connection when connecting to the SMTP server.
User Name: The user ID Liferay DXP should use to log into the SMTP server.
Password: The password Liferay DXP should use to log into the SMTP server.
Manually specify additional JavaMail properties to override the above configuration: If there are additional properties you need to specify, supply them here.
-
Click Save.
Liferay DXP connects to the mail session immediately.
Built-in Mail Session Portal Properties
If you prefer specifying your mail session offline or before deploying Liferay DXP, use portal properties.
-
Create a
portal-ext.properties
file, if you haven’t already created one. -
Copy these default property settings into your
portal-ext.properties
file:mail.session.mail=false mail.session.mail.pop3.host=localhost mail.session.mail.pop3.password= mail.session.mail.pop3.port=110 mail.session.mail.pop3.user= mail.session.mail.smtp.auth=false mail.session.mail.smtp.host=localhost mail.session.mail.smtp.password= mail.session.mail.smtp.port=25 mail.session.mail.smtp.user= mail.session.mail.store.protocol=pop3 mail.session.mail.transport.protocol=smtp
-
Replace the default mail session values with your own.
-
Put the
portal-ext.properties
file into your LIFERAY_HOME, once you’ve established it based on your installation.
Liferay DXP connects to the mail session on the next startup.
Configuring a Mail Session on the Application Server
You can manage a mail session for Liferay DXP on your application server. Here’s how:
-
Create a mail session on your application server, following your application server documentation.
-
Point Liferay DXP to that mail session using the Control Panel or portal properties. Here are instructions for both:
-
Configure the JNDI name in the Mail page at Control Panel → Configuration → Server Administration → Mail.
-
Set a
mail.session.jndi.name
portal property in a[LIFERAY_HOME]/portal-ext.properties
file. Here’s an example property:mail.session.jndi.name=mail/MailSession
-
Lastly, configure your instance’s email senders.
Configuring default email senders
Email senders are the default name and email address Liferay DXP uses to send administrative emails and announcement emails.
Default email senders are configured in the
portal-ext.properties
file.
-
Admin email configuration:
admin.email.from.name=Joe Bloggs admin.email.from.address=test@domain.invalid
-
Announcements email configuration:
announcements.email.to.name= announcements.email.to.address=noreply@domain.invalid
- Replace the names and email addresses above with your values.
- Restart your server.
Congratulations on configuring mail for Liferay DXP.