How to set up a Mail Server with DXP to receive email notifications?


  • This article outlines how to set up a Mail Server and SMTP in Liferay DXP to receive emails.


  • Liferay DXP 7.3


  • Liferay DXP uses a mail server and SMTP to get email notifications. Liferay DXP’s built-in mail session is the easiest way to configure mail and it’s recommended.
  • To fully utilize this, users need to go through some steps on Google's end. To receive emails, users must enable 'Less Secure Apps' settings, however, Google stopped supporting less secure apps on May 30th, 2022. As a result, instead of this step, use 2-Step Verification and generate an app password.
    • Google Account > Security > 2-Step Verification > Input password as asked > Turn ON
    • Google Account > Security > App password > Input password as asked > Select the app >  Custom name -> Input app name (e.g. Myemails )-> Generateprotect-your-security-ss.pngApp-Password-SS.png
    • Copy a 16-character password
    • Use a 16-character password with a Gmail username ( on the Liferay side.
  • Set up IMAP and change your SMTP settings to read Gmail messages
    • On your computer, open Gmail.
    • In the top right, click Settings Settings and then See all settings.
    • Click the Forwarding and POP/IMAP tab.
    • In the 'IMAP Access' section, select Enable IMAP.
    • Click Save Changes.
  • Now, configuring Liferay DXP’s Built-in Mail Session in the Control Panel.
    • Navigate to Control Panel-> System-> Server Administration-> Mail
    • Outgoing SMTP Server: Liferay DXP uses this server to send emails, such as password change emails and other notifications (as the Gmail server has been used here, and the Gmail SMTP server address is
      Outgoing Port: The port on which the SMTP server is listening (SMTP Ports 25, 465, & 587. The 465 port has been used here)
      Use a Secure Network Connection: Check this option.
      User Name: The user ID Liferay DXP should use to log into the SMTP server.
      Password: Use the generated 16-character password generated by the Gmail side.


    • Click on the Save button
    • Navigate to Control Panel-> Instance Settings-> Email-> Email Sender, change Name and Address.Emial-Sender.png

Additional Information

  • Google Support Link: Sign in using app passwords
  • By creating a new user and changing their password, the configuration can be validated.
  • To avoid the issues shown below, double-check the login and password or check the 2-Step Verification step
ERROR [liferay/mail-4][MailEngine:74] Unable to send message: 535-5.7.8 Username and Password not accepted. Learn more at_535 5.7.8 y12sm2192864pgk.7 - gsmtp_ [Sanitized]
javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. Learn more at_535 5.7.8 y12sm2192864pgk.7 - gsmtp_ [Sanitized]
at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(
at com.sun.mail.smtp.SMTPTransport.authenticate(
at com.sun.mail.smtp.SMTPTransport.protocolConnect(
at javax.mail.Service.connect(
at com.liferay.petra.mail.MailEngine._send(
at com.liferay.petra.mail.MailEngine.send(
at com.liferay.petra.mail.MailEngine.send(
at com.liferay.mail.messaging.MailMessageListener.doMailMessage(
at com.liferay.mail.messaging.MailMessageListener.doReceive(
at com.liferay.portal.kernel.messaging.BaseMessageListener.doReceive(
Was this article helpful?
1 out of 3 found this helpful