支持自定义接收邮箱地址 (#2973)

* 支持自定义接收邮箱地址

* 新增支持多个接收邮箱,同步到node和系统内置版本
This commit is contained in:
Max
2026-05-06 00:34:26 +08:00
committed by GitHub
parent a1ae08da58
commit 1315578878
4 changed files with 43 additions and 14 deletions
+10 -1
View File
@@ -91,6 +91,14 @@ export default class NotificationService {
return true;
}
private parseMailRecipients(value?: string) {
const recipients = (value || '')
.split(/[;]/)
.map((item) => item.trim())
.filter(Boolean);
return recipients.length > 0 ? recipients : undefined;
}
private async gotify() {
const { gotifyUrl, gotifyToken, gotifyPriority = 1 } = this.params;
try {
@@ -592,6 +600,7 @@ export default class NotificationService {
private async email() {
const { emailPass, emailService, emailUser, emailTo } = this.params;
const recipients = this.parseMailRecipients(emailTo) || emailUser;
try {
const transporter = nodemailer.createTransport({
@@ -604,7 +613,7 @@ export default class NotificationService {
const info = await transporter.sendMail({
from: `"青龙快讯" <${emailUser}>`,
to: emailTo ? emailTo.split(';') : emailUser,
to: recipients,
subject: `${this.title}`,
html: `${this.content.replace(/\n/g, '<br/>')}`,
});