未收到Amazon SES退信通知

14

我已经在我的服务器上配置了Postfix,仅将 @gmail.com 邮件发送到Amazon SES:

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.com的PHP脚本发送到同一电子邮件地址不会导致电子邮件通知。


你好,你在一年半之前提出了这个问题...你找到解决方案了吗?我现在也面临同样的问题,我没有收到退信或投诉通知。 - Maria Vilaró
我也遇到了这个问题 - 你找到解决方法了吗? - niico
1个回答

1
我曾经遇到相同的问题。在我的情况下,我使用了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)

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接