Skip to content

Instantly share code, notes, and snippets.

@ntxinh
Created February 3, 2018 03:49
Show Gist options
  • Select an option

  • Save ntxinh/9e6e8bbe61b1741597e1f750eb736edb to your computer and use it in GitHub Desktop.

Select an option

Save ntxinh/9e6e8bbe61b1741597e1f750eb736edb to your computer and use it in GitHub Desktop.
Spring boot Send Mail
spring:
mail:
default-encoding: UTF-8
host: localhost
username: anyname
password: anypassword
port: 2525
properties:
mail:
smtp:
auth: true
starttls:
enable: true
protocol: smtp
test-connection: false
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
@Autowired
public JavaMailSender emailSender;
SimpleMailMessage message = new SimpleMailMessage();
message.setTo("nguyentrucxinh@outlook.com");
message.setSubject("Subject");
message.setText("test");
emailSender.send(message);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment