Send email in spring boot

Karthiksharma
Nov 9, 2021

Step 1: setup your Spring Boot application

Go ahead and initialize your Spring boot application anyway you like. I personally find https://start.spring.io/ a convenient way to get started, so I’m going to go ahead and generate a Maven Spring Boot application, with a Web dependency or you can simply make project by spring tool suite.

Step 2: Add the dependency of sending mail in pom.xml

update the maven project

Step 3: now set the smtp configuration in appilcation.properties file

Step 4: enable less secure apps on your email

click on this link https://myaccount.google.com/intro/security

Step 5: Write the Code in Controller file

Everytime you load the url localhost:8088/home email will be sent .

--

--

Karthiksharma

I’m a Mobile Developer enthusiast & a junior pursuing my Bachelors in Computer Science . I am passionate about Data Structure, Web Dev, Machine Learning.