feat: 允许自定义发送邮件 smtp 服务器

This commit is contained in:
13574 2023-02-18 17:18:57 +08:00
parent 50b4c37092
commit d7a63cb09d
No known key found for this signature in database
GPG Key ID: 8E7F775418622544
3 changed files with 23 additions and 4 deletions

@ -11,7 +11,9 @@
"mailConfig": {
"user":"",
"pass":"",
"mailto":""
"mailto":"",
"smtpServer":"",
"smtpPort":""
}
}
```
@ -20,6 +22,21 @@
>> user 发送方邮箱<br>
>> pass 有授权码的填授权码,没有的填密码,填了密码报错了找授权码<br>
>> mailto 接收方邮箱
<br>
>> smtpServer 发送邮件时使用的 smtp 服务器地址
<br>
>> smtpPort smtp 服务器端口
对于常用的邮件而言,配置列举如下
|服务|server|port|
|:-:|:----:|:---:|
|QQ 邮箱|smtp.qq.com|465/587|
|网易邮箱|smtp.163.com|465|
|...|...|...|
其余邮箱服务的配置可以在对应服务商的帮助文档中找到
### 用户配置
先放一个配置模板
```

@ -3,6 +3,8 @@
"mailConfig": {
"user":"",
"pass":"",
"mailto":""
"mailto":"",
"smtpServer":"",
"smtpPort":""
}
}

@ -31,8 +31,8 @@ log.info("获取成功")
if (globalConfig.sendMail == true) {
log.info("组装邮件发射器")
var transporter = nodemailer.createTransport({
host: 'smtp.163.com',
port: 465,
host: globalConfig.mailConfig.smtpServer,
port: globalConfig.mailConfig.smtpPort,
secure: true,
auth: {
user: globalConfig.mailConfig.user,