Created
February 3, 2018 03:49
-
-
Save ntxinh/9e6e8bbe61b1741597e1f750eb736edb to your computer and use it in GitHub Desktop.
Spring boot Send Mail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <dependency> | |
| <groupId>org.springframework.boot</groupId> | |
| <artifactId>spring-boot-starter-mail</artifactId> | |
| </dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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