当使用PHPMailer通过Amazon SES向BCC地址发送电子邮件时,SES会返回以下错误。
554 Transaction failed: Invalid email address undisclosed-recipients:;.
仅当“收件人”字段中没有指定地址并且填充“未公开收件人:;”时才会发生这种情况。我尝试使用“收件人”字段中指定的地址发送电子邮件,但它工作正常。当发送带有“收件人”字段中的地址和BCC的地址的电子邮件时,它也可以正常运行。
这是我用来将每个电子邮件地址添加为BCC的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时会出现此错误,但我还没有找到他们如何解决问题。
答案 0 :(得分:1)
如果“BCC”中的电子邮件与“收件人”字段中的电子邮件匹配,我就已经看到了这种情况。