-
Notifications
You must be signed in to change notification settings - Fork 6
SirajChaudhary edited this page Sep 25, 2022
·
5 revisions
You can send an email using spring-boot-starter-mail module.
Step1: Add mail dependency in pom.xml
<!-- spring boot starter mail -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
Step2: Add mail properties in application.yml
spring:
# SEND MAIL PROPERTIES
mail:
host: smtp.gmail.com
port: '587'
username: YOUR_GMAIL_USERNAME
password: YOUR_GMAIL_PASSWORD
properties:
mail:
smtp:
auth: 'true'
connectiontimeout: '5000'
timeout: '5000'
writetimeout: '5000'
starttls:
enable: 'true'
Step3: Use Mail API to send an email