fix(email): set sender before PHPMailer init

This commit is contained in:
kate522 committed 2026-09-04 13:56:11 +08:00
1 parent 0d7d4fea61
commit 05f40d7728
2 files changed
+24 -8

No files matched your search

@@ -47,7 +47,14 @@ test('email templates and SMTP use one aksrt_settings schema', () => {
})
test('SMTP authentication and failures use the canonical mail service', () => {
assert.match(coreHooks, /add_filter\('wp_mail_from',/)
assert.match(coreHooks, /add_filter\('wp_mail_from_name',/)
assert.match(coreHooks, /if \(empty\(\$mail\['enabled'\]\)\) return \$from/)
assert.match(coreHooks, /if \(empty\(\$mail\['enabled'\]\)\) return \$from_name/)
assert.match(coreHooks, /\$mail\['from_address'\]/)
assert.match(coreHooks, /\$mail\['from_name'\]/)
assert.match(coreHooks, /\$phpmailer->SMTPAuth\s*=\s*!empty\(\$mail\['auth'\]\)\s*&&\s*!empty\(\$mail\['username'\]\)/)
assert.doesNotMatch(coreHooks, /\$phpmailer->setFrom\(/)
assert.match(mail, /add_action\('wp_mail_failed',\s*\$capture_failure\)/)
assert.match(mail, /remove_action\('wp_mail_failed',\s*\$capture_failure\)/)
assert.match(mail, /error_log\('\[AKSRT\] SMTP 测试失败:'/)