diff --git a/back/data/notify.ts b/back/data/notify.ts
index 110ba3be..547a8446 100644
--- a/back/data/notify.ts
+++ b/back/data/notify.ts
@@ -117,6 +117,7 @@ export class EmailNotification extends NotificationBaseInfo {
public emailService: string = '';
public emailUser: string = '';
public emailPass: string = '';
+ public emailTo: string = '';
}
export class PushMeNotification extends NotificationBaseInfo {
diff --git a/back/services/notify.ts b/back/services/notify.ts
index feb5c482..10e3bf2a 100644
--- a/back/services/notify.ts
+++ b/back/services/notify.ts
@@ -604,7 +604,7 @@ export default class NotificationService {
}
private async email() {
- const { emailPass, emailService, emailUser } = this.params;
+ const { emailPass, emailService, emailUser, emailTo } = this.params;
try {
const transporter = nodemailer.createTransport({
@@ -617,7 +617,7 @@ export default class NotificationService {
const info = await transporter.sendMail({
from: `"青龙快讯" <${emailUser}>`,
- to: `${emailUser}`,
+ to: emailTo ? emailTo.split(';') : emailUser,
subject: `${this.title}`,
html: `${this.content.replace(/\n/g, '
')}`,
});
diff --git a/sample/notify.js b/sample/notify.js
index 8b9ad821..093fdc2b 100644
--- a/sample/notify.js
+++ b/sample/notify.js
@@ -84,7 +84,8 @@ const push_config = {
AIBOTK_NAME: '', // 智能微秘书 发送群名 或者好友昵称和type要对应好
SMTP_SERVICE: '', // 邮箱服务名称,比如 126、163、Gmail、QQ 等,支持列表 https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json
- SMTP_EMAIL: '', // SMTP 收发件邮箱,通知将会由自己发给自己
+ SMTP_EMAIL: '', // SMTP 发件邮箱
+ SMTP_TO: '', // SMTP 收件邮箱,默认通知将会发给发件邮箱
SMTP_PASSWORD: '', // SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定
SMTP_NAME: '', // SMTP 收发件人姓名,可随意填写
@@ -993,7 +994,8 @@ function fsBotNotify(text, desp) {
}
async function smtpNotify(text, desp) {
- const { SMTP_EMAIL, SMTP_PASSWORD, SMTP_SERVICE, SMTP_NAME } = push_config;
+ const { SMTP_EMAIL, SMTP_TO, SMTP_PASSWORD, SMTP_SERVICE, SMTP_NAME } =
+ push_config;
if (![SMTP_EMAIL, SMTP_PASSWORD].every(Boolean) || !SMTP_SERVICE) {
return;
}
@@ -1011,7 +1013,7 @@ async function smtpNotify(text, desp) {
const addr = SMTP_NAME ? `"${SMTP_NAME}" <${SMTP_EMAIL}>` : SMTP_EMAIL;
const info = await transporter.sendMail({
from: addr,
- to: addr,
+ to: SMTP_TO ? SMTP_TO.split(';') : addr,
subject: text,
html: `${desp.replace(/\n/g, '
')}`,
});
diff --git a/src/locales/en-US.json b/src/locales/en-US.json
index 52ada7fa..353b0df9 100644
--- a/src/locales/en-US.json
+++ b/src/locales/en-US.json
@@ -505,5 +505,6 @@
"强制打开": "Force Open",
"强制打开可能会导致编辑器显示异常": "Force opening may cause display issues in the editor",
"确认离开": "Confirm Leave",
- "当前文件未保存,确认离开吗": "Current file is not saved, are you sure to leave?"
+ "当前文件未保存,确认离开吗": "Current file is not saved, are you sure to leave?",
+ "收件邮箱地址,多个分号分隔,默认发送给发件邮箱地址": "Receiving email address, multiple semicolon separated, sent to the sending email address by default"
}
diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json
index e56e8cad..0a178572 100644
--- a/src/locales/zh-CN.json
+++ b/src/locales/zh-CN.json
@@ -505,6 +505,7 @@
"强制打开": "强制打开",
"强制打开可能会导致编辑器显示异常": "强制打开可能会导致编辑器显示异常",
"确认离开": "确认离开",
- "当前文件未保存,确认离开吗": "当前文件未保存,确认离开吗"
+ "当前文件未保存,确认离开吗": "当前文件未保存,确认离开吗",
+ "收件邮箱地址,多个分号分隔,默认发送给发件邮箱地址": "收件邮箱地址,多个分号分隔,默认发送给发件邮箱地址"
}
\ No newline at end of file
diff --git a/src/utils/config.ts b/src/utils/config.ts
index bfc64409..179710a2 100644
--- a/src/utils/config.ts
+++ b/src/utils/config.ts
@@ -400,7 +400,7 @@ export default {
),
required: true,
},
- { label: 'emailUser', tip: intl.get('邮箱地址'), required: true },
+ { label: 'emailUser', tip: intl.get('邮箱认证地址'), required: true },
{
label: 'emailPass',
tip: intl.get(
@@ -408,6 +408,10 @@ export default {
),
required: true,
},
+ {
+ label: 'emailTo',
+ tip: intl.get('收件邮箱地址,多个分号分隔,默认发送给发件邮箱地址'),
+ },
],
pushMe: [
{