Spring Boot: Java Mail Api

Hi Guys,
I would like to share simple but helpful concept to send a mail from boot application.

Spring boot provides a starter module which configure automatically based on provided properties and avail to use, by default spring framework provides abstraction to send mail using JavaMailSender interface.

To do same you have to change below files, here i am using gmail’s configuration for demo.


Below is the list of basic properties needs to be set.

Apart from these properties boot will allow other properties to be override in case of requirement, which are listed below.


Required below dependency.


A sample utility class used to combine everything required to send a mail.

The code is pretty simple and easy to understand, invoke send function using

And here we go.

Share current post by copy: https://goo.gl/50PtDR
Happy Learning!

Yogesh P