ZL-006-20260713 · Gatekeeper SMTP 从服务器白名单恢复发件身份
This commit is contained in:
parent
b11dcbf559
commit
4ca9725cc3
@ -294,8 +294,10 @@ function checkWhitelist(sourceServer, personalityId) {
|
||||
// ═══════════════════════════════════════
|
||||
function sendVerificationEmail(code, opType, callerName, callerPid, cmdPreview, targetEmail, targetName, serverIp) {
|
||||
return new Promise((resolve) => {
|
||||
if (!SMTP.pass) {
|
||||
log('WARN', 'email_skip', 'SMTP 授权码未配置');
|
||||
const sovereign = loadWhitelist().triads.find(t => t.human === 'ICE-GL∞' && t.email);
|
||||
const smtpUser = SMTP.user || (sovereign && sovereign.email) || '';
|
||||
if (!SMTP.pass || !smtpUser) {
|
||||
log('WARN', 'email_skip', 'SMTP 发件账号或授权码未配置');
|
||||
resolve(false);
|
||||
return;
|
||||
}
|
||||
@ -360,7 +362,7 @@ ICE-GL∞ 光湖语言系统 · 小湖灯自动发送
|
||||
国作登字-2026-A-00037559`;
|
||||
|
||||
const rawEmail =
|
||||
`From: 光湖小湖灯 <${SMTP.user}>\r\n` +
|
||||
`From: 光湖小湖灯 <${smtpUser}>\r\n` +
|
||||
`To: ${targetName} <${targetEmail}>\r\n` +
|
||||
`Subject: =?UTF-8?B?${Buffer.from(`${opInfo.icon} Gatekeeper授权 · ${callerName} · ${opInfo.label}`, 'utf-8').toString('base64')}?=\r\n` +
|
||||
`MIME-Version: 1.0\r\n` +
|
||||
@ -379,7 +381,7 @@ ICE-GL∞ 光湖语言系统 · 小湖灯自动发送
|
||||
`--${boundary}--\r\n` +
|
||||
`.\r\n`;
|
||||
|
||||
const authPlain = `\0${SMTP.user}\0${SMTP.pass}`;
|
||||
const authPlain = `\0${smtpUser}\0${SMTP.pass}`;
|
||||
|
||||
const socket = tls.connect({ host: SMTP.host, port: SMTP.port, rejectUnauthorized: false }, () => {
|
||||
let stage = 0;
|
||||
@ -400,7 +402,7 @@ ICE-GL∞ 光湖语言系统 · 小湖灯自动发送
|
||||
} else if (stage === 1) {
|
||||
if (isLast && code === 250) { stage = 2; socket.write('AUTH PLAIN ' + Buffer.from(authPlain).toString('base64') + '\r\n'); }
|
||||
} else if (stage === 2) {
|
||||
if (code === 235) { stage = 3; socket.write('MAIL FROM:<' + SMTP.user + '>\r\n'); }
|
||||
if (code === 235) { stage = 3; socket.write('MAIL FROM:<' + smtpUser + '>\r\n'); }
|
||||
else if (code >= 500) { log('WARN', 'smtp_auth_failed', line); socket.end(); resolve(false); return; }
|
||||
} else if (stage === 3) {
|
||||
if (code === 250) { stage = 4; socket.write('RCPT TO:<' + targetEmail + '>\r\n'); }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user