Echo/docs/20-发送邮件.md
2021-01-17 20:07:25 +08:00

35 lines
634 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 发送邮件功能
---
> 该功能用于注册模块
邮箱设置:
- 启用客户端 SMTP 服务
![](https://gitee.com/veal98/images/raw/master/img/20210117114026.png)
Spring Email
- 导入 jar 包
- 邮箱参数配置
```properties
# Spring Mail
spring.mail.host = smtp.sina.com
spring.mail.port = 465
# 邮箱用户名
spring.mail.username = xxx
# 授权码(不是密码)
spring.mail.password = xxx
spring.mail.protocol = smtps
spring.mail.properties.mail.smtp.ssl.enable = true
```
- 使用 JavaMailSender 发送普通文字邮件
模板引擎:
- 使用 Thymeleaf 发送 HTML 邮件