使用 PHPMailer 通过 Amazon SES 向密件抄送地址发送电子邮件时,SES 返回以下错误。
554 Transaction failed: Invalid email address undisclosed-recipients:;.
这只发生在“收件人”字段中没有指定地址并且用“未公开收件人:;”填充时。我尝试使用“收件人”字段中指定的地址发送电子邮件,并且工作正常。当发送带有“收件人”字段中的地址和密件抄送地址的电子邮件时,它也可以正常工作。
这是我用来将每个电子邮件地址添加为密件抄送的 PHP 代码,$Addresses
它是一个包含电子邮件地址的数组,没有密钥。
if(is_array($Addresses))
{
foreach ($Addresses as $Email) {
$Mail->AddBCC($Email);
}
}
这是 PHPMailer 的输出。
Invalid address: Noreply
CLIENT -> SMTP: MAIL FROM:<*redacted*>
SMTP -> FROM SERVER:250 Ok
CLIENT -> SMTP: RCPT TO:<*redacted, bcc'd address*>
SMTP -> FROM SERVER:250 Ok
CLIENT -> SMTP: RCPT TO:<*redacted, bcc'd address*>
SMTP -> FROM SERVER:250 Ok
CLIENT -> SMTP: DATA
SMTP -> FROM SERVER:354 End data with <CR><LF>.<CR><LF>
CLIENT -> SMTP: Date: Mon, 12 Aug 2013 20:46:09 +0000
CLIENT -> SMTP: Return-Path: <*redacted*>
CLIENT -> SMTP: To: undisclosed-recipients:;
CLIENT -> SMTP: From: Noreply <*redacted*>
CLIENT -> SMTP: Subject: *redacted*
CLIENT -> SMTP: Message-ID: <*redacted*>
CLIENT -> SMTP: X-Priority: 3
CLIENT -> SMTP: X-Mailer: PHPMailer 5.2.6 (https://github.com/PHPMailer/PHPMailer/)
CLIENT -> SMTP: MIME-Version: 1.0
CLIENT -> SMTP: Content-Type: text/html; charset=iso-8859-1
CLIENT -> SMTP: Content-Transfer-Encoding: 8bit
CLIENT -> SMTP:
CLIENT -> SMTP: *redacted*
CLIENT -> SMTP:
CLIENT -> SMTP: .
SMTP -> FROM SERVER:554 Transaction failed: Invalid email address undisclosed-recipients:;.
SMTP -> ERROR: DATA not accepted from server: 554 Transaction failed: Invalid email address undisclosed-recipients:;.
SMTP Error: Data not accepted.
CLIENT -> SMTP: quit
SMTP -> FROM SERVER:221 Bye
string(126) "SMTP Error: Data not accepted.
SMTP server error: Transaction failed: Invalid email address undisclosed-recipients:;.
我还发现一些人在使用带有 SES 的 Postfix 时遇到了这个错误,但我还没有找到他们是如何解决这个问题的。