未收到Amazon SES退回通知

我在我的服务器上配置了postfix,以便仅向Amazon SES提供@ gmail.com邮件:

gmail.com          smtp:email-smtp.eu-west-1.amazonaws.com:25
*                  :

另外,我在Amazon SES控制台中配置了使用Amazon SNS在邮件上接收反弹和投诉。 问题是,如果我将邮件发送到不存在的Gmail地址,我不会收到反弹。

如果将邮件从mail.google.com发送到地址dsadaerwer.lala-band-sucks.justin-is-a-beaver@gmail.com,我会收到:

Delivery to the following recipient failed permanently:
 dsadaerwer.lala-band-sucks.justin-is-a-beaver@gmail.com

但是,如果从PHP脚本发送到相同的地址,postfix说:

E4E1A9F9CE: to=<dsadaerwer.lala-band-sucks.justin-is-a-beaver@gmail.com>, relay=email-smtp.eu-west-1.amazonaws.com[54.72.42.170]:25, delay=21, delays=0.02/0.04/11/10, dsn=2.0.0, status=sent (250 Ok 00000146d86bcc13-9fa1ac16-b1cd-476e-8398-31f406d47961-000000)

所以亚马逊SES接受邮件,但我没有得到有关失败的通知。 什么可能是错误的?

注意。 发送到有效的电子邮件时,一切都按预期工作。

另外,当从AWS SES控制台发送测试邮件到bounce@simulator.amazonses.com时,我立即通过电子邮件通知我,但通过email-smtp.eu-west-1.amazonaws从PHP脚本发送到同一封电子邮件。 com不会导致电子邮件通知。


我面临同样的问题。 在我的情况下,我使用PHPMailer库(https://github.com/PHPMailer/PHPMailer/),并通过指定消息的发送者来解决它。

/**
 * The Sender email (Return-Path) of the message.
 * If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
 * @type string
 */
public $Sender = '';

我将它设置为与$ From相同的地址,我现在收到预期地址的反弹。

所以这是我的工作代码:

$this->mail = new PHPMailer();
$this->mail->CharSet = 'utf-8';
$this->mail->From = $from_address;
$this->mail->Sender = $from_address;
$this->mail->FromName = $from_name;
$this->mail->Subject = $subject;
$this->mail->Body    = $body;
$this->mail->AltBody = $altBody;
$this->mail->addAddress($to_address, $to_name);
$this->mail->send()

如果您在PHPMailer中使用setFrom方法,它也会自动将发件人设置为相同的地址。

/**
 * Set the From and FromName properties.
 * @param string $address
 * @param string $name
 * @param boolean $auto Whether to also set the Sender address, defaults to true
 * @throws phpmailerException
 * @return boolean
 */
public function setFrom($address, $name = '', $auto = true)
链接地址: http://www.djcxy.com/p/32201.html

上一篇: Not receiving Amazon SES Bounce Notifications

下一篇: SQS does not receive messages posted through SNS