spring_reference/IV. Spring Boot features/31. Sending email.md

7 lines
735 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

### 31. 发送邮件
Spring框架使用JavaMailSender接口为发送邮件提供了一个简单的抽象并且Spring Boot也为它提供了自动配置和一个starter模块。
具体查看[JavaMailSender参考文档](http://docs.spring.io/spring/docs/4.1.4.RELEASE/spring-framework-reference/htmlsingle/#mail)。
如果spring.mail.host和相关的库通过spring-boot-starter-mail定义都存在一个默认的JavaMailSender将被创建。该sender可以通过spring.mail命名空间下的配置项进一步自定义具体参考[MailProperties](http://github.com/spring-projects/spring-boot/tree/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailProperties.java)。