How to Configure the Email Notifier with Payara Server 171 & Gmail
Originally published on 10 Mar 2017
Last updated on 16 Jul 2021
The latest version of Payara Server extends the Notification Service with many ways how to process notifications and send them to external services. Sending notifications as email messages to an SMTP server is now provided out of the box. It is even possible to use an account on a public email server, such as Gmail. In this guest blog, Alessio Gennari - a member of the Payara open source community - explains to you exactly how it can be done.
To successfully configure a JavaMail Session in Payara Server 171 with your Gmail account, first you need to modify the following settings for a JavaMail session in Payara Server:
- set JNDI Name with a name that will be used to refer to it from the Notification Service
- set Mail Host to smtp.gmail.com
- set Default User with your gmail address
- set Default Sender Address with any email address you prefer
Now you need to set some additional properties of the JavaMail Session to enable Payara Server to send emails through your Gmail account. Here are the properties you have to set:
- mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
- mail.smtp.socketFactory.port=465
- mail.smtp.port=465
- mail.smtp.auth=true
- mail.smtp.password=<gmail account password>
- mail.smtp.user=<gmail account email address>
You can find the correct settings in the following figure:
All other settings can be left at default values.
Now you can enable email notifications using the JNDI name of the JavaMail session, and Payara Server can send notifications via your Gmail account.
Related Posts
Continuous Integration and Continuous Deployment for Jakarta EE Applications Made Easy
Published on 25 Mar 2024
by Luqman Saeed
0 Comments
Easy Jakarta EE Integration Testing with the Payara Platform and Testcontainers
Published on 24 Mar 2022
by Fabio Turizo
0 Comments