Linux下使用JavaMailSender发送邮件的配置
Linux下使用默认端口25报错,协议改为smtps,端口号改为465
spring:
mail:
#smtp服务主机 qq邮箱则为smtp.qq.com
host: smtp.163.com
#服务协议
protocol: smtps
# 编码集
default-encoding: UTF-8
#发送邮件的账户
username: xxx@163.com
#授权码
password: xxx
test-connection: true
properties:
mail:
smtp:
auth: true
socketFactory:
port: 465
class: javax.net.ssl.SSLSocketFactory
fallback: false
starttls:
enable: true
required: true
port: 465