From d7a63cb09d9b0d300aadfac2182d595419d024d4 Mon Sep 17 00:00:00 2001 From: 13574 <1357496606@qq.com> Date: Sat, 18 Feb 2023 17:18:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=85=81=E8=AE=B8=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=8F=91=E9=80=81=E9=82=AE=E4=BB=B6=20smtp=20?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 19 ++++++++++++++++++- global.json | 4 +++- index.js | 4 ++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f2d84c3..dc7ebbe 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,9 @@ "mailConfig": { "user":"", "pass":"", - "mailto":"" + "mailto":"", + "smtpServer":"", + "smtpPort":"" } } ``` @@ -20,6 +22,21 @@ >> user 发送方邮箱
>> pass 有授权码的填授权码,没有的填密码,填了密码报错了找授权码
>> mailto 接收方邮箱 +
+>> smtpServer 发送邮件时使用的 smtp 服务器地址 +
+>> smtpPort smtp 服务器端口 + +对于常用的邮件而言,配置列举如下 + +|服务|server|port| +|:-:|:----:|:---:| +|QQ 邮箱|smtp.qq.com|465/587| +|网易邮箱|smtp.163.com|465| +|...|...|...| + +其余邮箱服务的配置可以在对应服务商的帮助文档中找到 + ### 用户配置 先放一个配置模板 ``` diff --git a/global.json b/global.json index 768730b..b20de12 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,8 @@ "mailConfig": { "user":"", "pass":"", - "mailto":"" + "mailto":"", + "smtpServer":"", + "smtpPort":"" } } \ No newline at end of file diff --git a/index.js b/index.js index 8e40021..9072934 100644 --- a/index.js +++ b/index.js @@ -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,