mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
邮箱通知支持多个收件人
This commit is contained in:
parent
d871585eee
commit
710a107e73
|
@ -117,6 +117,7 @@ export class EmailNotification extends NotificationBaseInfo {
|
||||||
public emailService: string = '';
|
public emailService: string = '';
|
||||||
public emailUser: string = '';
|
public emailUser: string = '';
|
||||||
public emailPass: string = '';
|
public emailPass: string = '';
|
||||||
|
public emailTo: string = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PushMeNotification extends NotificationBaseInfo {
|
export class PushMeNotification extends NotificationBaseInfo {
|
||||||
|
|
|
@ -604,7 +604,7 @@ export default class NotificationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async email() {
|
private async email() {
|
||||||
const { emailPass, emailService, emailUser } = this.params;
|
const { emailPass, emailService, emailUser, emailTo } = this.params;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const transporter = nodemailer.createTransport({
|
const transporter = nodemailer.createTransport({
|
||||||
|
@ -617,7 +617,7 @@ export default class NotificationService {
|
||||||
|
|
||||||
const info = await transporter.sendMail({
|
const info = await transporter.sendMail({
|
||||||
from: `"青龙快讯" <${emailUser}>`,
|
from: `"青龙快讯" <${emailUser}>`,
|
||||||
to: `${emailUser}`,
|
to: emailTo ? emailTo.split(';') : emailUser,
|
||||||
subject: `${this.title}`,
|
subject: `${this.title}`,
|
||||||
html: `${this.content.replace(/\n/g, '<br/>')}`,
|
html: `${this.content.replace(/\n/g, '<br/>')}`,
|
||||||
});
|
});
|
||||||
|
|
|
@ -84,7 +84,8 @@ const push_config = {
|
||||||
AIBOTK_NAME: '', // 智能微秘书 发送群名 或者好友昵称和type要对应好
|
AIBOTK_NAME: '', // 智能微秘书 发送群名 或者好友昵称和type要对应好
|
||||||
|
|
||||||
SMTP_SERVICE: '', // 邮箱服务名称,比如 126、163、Gmail、QQ 等,支持列表 https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json
|
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_PASSWORD: '', // SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定
|
||||||
SMTP_NAME: '', // SMTP 收发件人姓名,可随意填写
|
SMTP_NAME: '', // SMTP 收发件人姓名,可随意填写
|
||||||
|
|
||||||
|
@ -993,7 +994,8 @@ function fsBotNotify(text, desp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function smtpNotify(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) {
|
if (![SMTP_EMAIL, SMTP_PASSWORD].every(Boolean) || !SMTP_SERVICE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1011,7 +1013,7 @@ async function smtpNotify(text, desp) {
|
||||||
const addr = SMTP_NAME ? `"${SMTP_NAME}" <${SMTP_EMAIL}>` : SMTP_EMAIL;
|
const addr = SMTP_NAME ? `"${SMTP_NAME}" <${SMTP_EMAIL}>` : SMTP_EMAIL;
|
||||||
const info = await transporter.sendMail({
|
const info = await transporter.sendMail({
|
||||||
from: addr,
|
from: addr,
|
||||||
to: addr,
|
to: SMTP_TO ? SMTP_TO.split(';') : addr,
|
||||||
subject: text,
|
subject: text,
|
||||||
html: `${desp.replace(/\n/g, '<br/>')}`,
|
html: `${desp.replace(/\n/g, '<br/>')}`,
|
||||||
});
|
});
|
||||||
|
|
|
@ -505,5 +505,6 @@
|
||||||
"强制打开": "Force Open",
|
"强制打开": "Force Open",
|
||||||
"强制打开可能会导致编辑器显示异常": "Force opening may cause display issues in the editor",
|
"强制打开可能会导致编辑器显示异常": "Force opening may cause display issues in the editor",
|
||||||
"确认离开": "Confirm Leave",
|
"确认离开": "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"
|
||||||
}
|
}
|
||||||
|
|
|
@ -505,6 +505,7 @@
|
||||||
"强制打开": "强制打开",
|
"强制打开": "强制打开",
|
||||||
"强制打开可能会导致编辑器显示异常": "强制打开可能会导致编辑器显示异常",
|
"强制打开可能会导致编辑器显示异常": "强制打开可能会导致编辑器显示异常",
|
||||||
"确认离开": "确认离开",
|
"确认离开": "确认离开",
|
||||||
"当前文件未保存,确认离开吗": "当前文件未保存,确认离开吗"
|
"当前文件未保存,确认离开吗": "当前文件未保存,确认离开吗",
|
||||||
|
"收件邮箱地址,多个分号分隔,默认发送给发件邮箱地址": "收件邮箱地址,多个分号分隔,默认发送给发件邮箱地址"
|
||||||
}
|
}
|
||||||
|
|
|
@ -400,7 +400,7 @@ export default {
|
||||||
),
|
),
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
{ label: 'emailUser', tip: intl.get('邮箱地址'), required: true },
|
{ label: 'emailUser', tip: intl.get('邮箱认证地址'), required: true },
|
||||||
{
|
{
|
||||||
label: 'emailPass',
|
label: 'emailPass',
|
||||||
tip: intl.get(
|
tip: intl.get(
|
||||||
|
@ -408,6 +408,10 @@ export default {
|
||||||
),
|
),
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'emailTo',
|
||||||
|
tip: intl.get('收件邮箱地址,多个分号分隔,默认发送给发件邮箱地址'),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
pushMe: [
|
pushMe: [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user