35 lines
634 B
Markdown
35 lines
634 B
Markdown
![]() |
# 发送邮件功能
|
|||
|
|
|||
|
---
|
|||
|
|
|||
|
> 该功能用于注册模块
|
|||
|
|
|||
|
邮箱设置:
|
|||
|
|
|||
|
- 启用客户端 SMTP 服务
|
|||
|
|
|||
|

|
|||
|
|
|||
|
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 邮件
|