Fix: Add custom SMTP host/port/secure settings to fix AliyunQiye email connection error

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-03-07 13:31:42 +00:00
parent d68c5b85bd
commit aecdd7852b
5 changed files with 62 additions and 6 deletions

View File

@ -116,6 +116,9 @@ export class EmailNotification extends NotificationBaseInfo {
public emailUser: string = ''; public emailUser: string = '';
public emailPass: string = ''; public emailPass: string = '';
public emailTo: string = ''; public emailTo: string = '';
public emailHost: string = '';
public emailPort: string = '';
public emailSecure: string = '';
} }
export class PushMeNotification extends NotificationBaseInfo { export class PushMeNotification extends NotificationBaseInfo {

View File

@ -590,16 +590,44 @@ export default class NotificationService {
} }
private async email() { private async email() {
const { emailPass, emailService, emailUser, emailTo } = this.params; const {
emailPass,
emailService,
emailUser,
emailTo,
emailHost,
emailPort,
emailSecure,
} = this.params;
try { try {
const transporter = nodemailer.createTransport({ const transportConfig: {
service: emailService, service?: string;
host?: string;
port?: number;
secure?: boolean;
auth: { user: string; pass: string };
} = {
auth: { auth: {
user: emailUser, user: emailUser,
pass: emailPass, pass: emailPass,
}, },
}); };
if (emailHost) {
transportConfig.host = emailHost;
transportConfig.port = emailPort
? Math.max(1, Math.min(65535, parseInt(emailPort, 10) || 465))
: 465;
transportConfig.secure =
emailSecure !== undefined && emailSecure !== ''
? emailSecure === 'true'
: transportConfig.port === 465;
} else {
transportConfig.service = emailService;
}
const transporter = nodemailer.createTransport(transportConfig);
const info = await transporter.sendMail({ const info = await transporter.sendMail({
from: `"青龙快讯" <${emailUser}>`, from: `"青龙快讯" <${emailUser}>`,

View File

@ -390,7 +390,11 @@
"调用版本专业版填写pro个人版填写personal为空默认使用专业版": "Version, you can specify 'pro' for the Professional version and 'personal' for the Personal version. If left blank, it will default to the Professional version.", "调用版本专业版填写pro个人版填写personal为空默认使用专业版": "Version, you can specify 'pro' for the Professional version and 'personal' for the Personal version. If left blank, it will default to the Professional version.",
"飞书群组机器人https://www.feishu.cn/hc/zh-CN/articles/360024984973": "Feishu group bot: https://www.feishu.cn/hc/zh-CN/articles/360024984973", "飞书群组机器人https://www.feishu.cn/hc/zh-CN/articles/360024984973": "Feishu group bot: https://www.feishu.cn/hc/zh-CN/articles/360024984973",
"飞书群组机器人加签密钥,安全设置中开启签名校验后获得": "Feishu group bot signature secret, obtained after enabling signature verification in security settings", "飞书群组机器人加签密钥,安全设置中开启签名校验后获得": "Feishu group bot signature secret, obtained after enabling signature verification in security settings",
"邮箱服务名称比如126、163、Gmail、QQ等支持列表https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json设置emailHost后此项可不填": "Email service name, e.g., 126, 163, Gmail, QQ, etc. Supported list: https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json. Can be left blank if emailHost is set",
"邮箱服务名称比如126、163、Gmail、QQ等支持列表https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json": "Email service name, e.g., 126, 163, Gmail, QQ, etc. Supported list: https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json", "邮箱服务名称比如126、163、Gmail、QQ等支持列表https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json": "Email service name, e.g., 126, 163, Gmail, QQ, etc. Supported list: https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json",
"自定义SMTP服务器地址设置后将忽略emailService中的服务器配置如smtp.qiye.aliyun.com": "Custom SMTP server address. When set, the server configuration in emailService will be ignored. E.g., smtp.qiye.aliyun.com",
"自定义SMTP端口号默认465": "Custom SMTP port number, default is 465",
"是否使用SSL/TLS端口为465时默认为true否则默认为false": "Whether to use SSL/TLS. Defaults to true when port is 465, otherwise false",
"邮箱地址": "Email Address", "邮箱地址": "Email Address",
"SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定": "The SMTP login password may also be a special passphrase, depending on the specific email service provider's instructions", "SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定": "The SMTP login password may also be a special passphrase, depending on the specific email service provider's instructions",
"PushMe的Keyhttps://push.i-i.me/": "PushMe key, https://push.i-i.me/", "PushMe的Keyhttps://push.i-i.me/": "PushMe key, https://push.i-i.me/",

View File

@ -390,7 +390,11 @@
"调用版本专业版填写pro个人版填写personal为空默认使用专业版": "调用版本专业版填写pro个人版填写personal为空默认使用专业版", "调用版本专业版填写pro个人版填写personal为空默认使用专业版": "调用版本专业版填写pro个人版填写personal为空默认使用专业版",
"飞书群组机器人https://www.feishu.cn/hc/zh-CN/articles/360024984973": "飞书群组机器人https://www.feishu.cn/hc/zh-CN/articles/360024984973", "飞书群组机器人https://www.feishu.cn/hc/zh-CN/articles/360024984973": "飞书群组机器人https://www.feishu.cn/hc/zh-CN/articles/360024984973",
"飞书群组机器人加签密钥,安全设置中开启签名校验后获得": "飞书群组机器人加签密钥,安全设置中开启签名校验后获得", "飞书群组机器人加签密钥,安全设置中开启签名校验后获得": "飞书群组机器人加签密钥,安全设置中开启签名校验后获得",
"邮箱服务名称比如126、163、Gmail、QQ等支持列表https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json设置emailHost后此项可不填": "邮箱服务名称比如126、163、Gmail、QQ等支持列表https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json设置emailHost后此项可不填",
"邮箱服务名称比如126、163、Gmail、QQ等支持列表https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json": "邮箱服务名称比如126、163、Gmail、QQ等支持列表https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json", "邮箱服务名称比如126、163、Gmail、QQ等支持列表https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json": "邮箱服务名称比如126、163、Gmail、QQ等支持列表https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json",
"自定义SMTP服务器地址设置后将忽略emailService中的服务器配置如smtp.qiye.aliyun.com": "自定义SMTP服务器地址设置后将忽略emailService中的服务器配置如smtp.qiye.aliyun.com",
"自定义SMTP端口号默认465": "自定义SMTP端口号默认465",
"是否使用SSL/TLS端口为465时默认为true否则默认为false": "是否使用SSL/TLS端口为465时默认为true否则默认为false",
"邮箱地址": "邮箱地址", "邮箱地址": "邮箱地址",
"SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定": "SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定", "SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定": "SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定",
"PushMe的Keyhttps://push.i-i.me/": "PushMe的Keyhttps://push.i-i.me/", "PushMe的Keyhttps://push.i-i.me/": "PushMe的Keyhttps://push.i-i.me/",

View File

@ -406,9 +406,26 @@ export default {
{ {
label: 'emailService', label: 'emailService',
tip: intl.get( tip: intl.get(
'邮箱服务名称比如126、163、Gmail、QQ等支持列表https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json', '邮箱服务名称比如126、163、Gmail、QQ等支持列表https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json设置emailHost后此项可不填',
), ),
required: true, },
{
label: 'emailHost',
tip: intl.get(
'自定义SMTP服务器地址设置后将忽略emailService中的服务器配置如smtp.qiye.aliyun.com',
),
},
{
label: 'emailPort',
tip: intl.get('自定义SMTP端口号默认465'),
},
{
label: 'emailSecure',
tip: intl.get('是否使用SSL/TLS端口为465时默认为true否则默认为false'),
items: [
{ value: 'true', label: 'true' },
{ value: 'false', label: 'false' },
],
}, },
{ label: 'emailUser', tip: intl.get('邮箱认证地址'), required: true }, { label: 'emailUser', tip: intl.get('邮箱认证地址'), required: true },
{ {