How to Send E-Mails From Hybris Commerce Using Google Mail?

At a recent client engagement, the client asked to review the Hybris Commerce Out-of-the-Box (OOTB) email templates' copy early in the project. During this engagement, I worked off-site on most days, and could not reliably access the client's SMTP Server to send emails from Hybris. In this situation, I decided to use my Gmail account to send Hybris emails to the client directly. In this tutorial, I will demonstrate how to send emails from Hybris Commerce using Google Mail (Gmail).

Prerequisites: To complete this tutorial, you will need a Google Mail (Gmail) account.

Note: Hybris Commerce 6.x OOTB has SMTP disabled in the project. properties file.

  1. Copy the commented SMTP configuration settings from the file, then paste these settings into the file in your preferred IDE. It's considered a best practice to make custom changes to the (located in the config directory) file instead of modifying the file. For good measure, I will also update the mail.from and mail.replyto properties. After pasting the SMTP settings into the file, the file should now include the following settings:
  2. Un-comment the SMTP Settings in the file. Remove the (#) symbols at the beginning of each SMTP configuration setting.
    Your file should now resemble the following:
  3. Update the SMTP Settings with your Google Mail (Gmail) settings and set mail.use.tls to true . Insert your address where you see in the next screen capture. Note: Google Mail is the email provider for Custom domain email addresses hosted with Google Mail are also supported. The following settings are required to send emails using Google Mail:

  4.  Open the command prompt.
  5. Go to <HYBRIS_BIN_DIR>/platform , and start Hybris by running hybrisserver.bat (Windows) or ./ (Linux).
    No need to perform an ant all command, it's not required for property file modifications. However, you will need to stop Hybris, if it is currently running, then restart by running the hybrisserver.bat or / After several minutes, Hybris should be up and running.
  6. Sign into HAC to verify the email settings are configured properly in Hybris.

  7.  Once you've signed in successfully, click on Platform-> Configuration.
  8. Type SMTP into the Search Box to confirm the SMTP settings have been properly configured in Hybris. The mail.smtp.password, mail.smtp.port, mail.smtp.server and mail.smtp.user should contain the values set in the file in step #3.
  9. Type tls into the Search Box to confirm the mail.use.tls setting has been properly set to true.
  10. The tutorial is complete, now you know how to send e-mails from Hybris Commerce using Google Mail.


Troubleshooting notes

If you receive the following error: Script execution has failed [reason: org.apache.commons.mail.EmailException: Sending the email to the following server failed :]
1. Go to your Google Account's Less Secure Apps page:
2. Set Allow less secure apps to ON

Watch the Video 

How to Send E-Mails From Hybris Commerce Using Google Mail (Video Edition)


About the author

Marc is the Founder of He enjoys helping others learn more about SAP Hybris Commerce. Marc has held the role of Hybris Architect at Exemplis and Nasty Gal. He is a long-time Java/Spring developer. Marc holds an M.S. Software Engineering from Carnegie Mellon University and a B.S. in Accountancy from California State University, Fresno. He can be reached at:

Add a Comment

Your email address will not be published. Required fields are marked *