DEV Community

loading...

How to configure JavaMailSender with SpringBoot

loizenai profile image loizenai ・1 min read

https://grokonez.com/spring-framework/spring-boot/configure-javamailsender-springboot

How to configure JavaMailSender with SpringBoot

Spring Framework provides JavaMailSender interface & Spring Boot provides auto-configuration for it. So in the tutorial, JavaSampleApproach will introduce how to configure JavaMailSender to send a gmail by a sample code.

I. Technologies

– Java 1.8
– Maven 3.3.9
– Spring Tool Suite – Version 3.8.1.RELEASE
– Spring Boot: 1.5.1.RELEASE

II. Practice

Step to do

  • Create SpringBoot project
  • Create MailSender
  • Develop a test client
  • Run & check results

    1. Create SpringBoot project

    – Using SpringToolSuite, create a SpringBoot project. Then add spring-boot-starter-mail dependency:
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-mail</artifactId>
    </dependency>

    2. Create MailSender

  • Firstly, open application.properties file, configure spring.mail for JavaMailSender:

More at:

https://grokonez.com/spring-framework/spring-boot/configure-javamailsender-springboot

How to configure JavaMailSender with SpringBoot

Discussion (0)

Forem Open with the Forem app