我正在使用 phpmailer 发送电子邮件。
当我添加列表取消订阅时,电子邮件会发送到除 gmail 之外的所有帐户。它只是被丢弃,它不会进入垃圾邮件,它永远不会到达 gmail 帐户。当我删除列表取消订阅时,它会成功发送到 gmail 帐户。
这是我正在使用的列表取消订阅:
List-Unsubscribe:<http://keepity.com>,<mailto:admin@keepity.com>
这就是它在 phpmailer 中的调用方式:
$mail->AddCustomHeader("List-Unsubscribe:<http://keepity.com>,<mailto:admin@keepity.com>");
这是调用 phpmailer 的完整函数。如果我注释掉列表取消订阅,那么邮件将被传递到 gmail 帐户,否则它永远不会到达。有谁知道为什么不发货?
static function phpmailer_sendmail($mail,$from,$fromAlias,$to,$replyTo,$replyToAlias,$subject,$html,$text) {
require_once (JPATH_COMPONENT.DS.'PHPMailer-master/class.phpmailer.php');
$mail = new PHPMailer(true); // by setting TRUE you enable exceptions
$mail->IsSMTP(true); // SMTP
$mail->SMTPAuth = true; // SMTP authentication
$mail->Mailer = "smtp";
$mail->Host= "xyz"; // Amazon SES
$mail->Port = 465; // SMTP Port
$mail->Username = "xyz"; // SMTP Username
$mail->Password = "xyz"; // SMTP Password
$mail->ClearAllRecipients();
$mail->ClearAddresses();
$mail->ClearCCs();
$mail->ClearBCCs();
$mail->ClearReplyTos();
$mail->ClearAttachments();
$mail->ClearCustomHeaders();
$mail->SetFrom($from, $fromAlias);
$mail->AddReplyTo($replyTo,$replyToAlias);
$mail->Subject = $subject;
$mail->IsHTML(true);
$mail->Body = $html;
$mail->AltBody = $text;
$address = $to;
$addressAlias = $to;
$mail->AddAddress($address, $addressAlias);
$mail->AddCustomHeader("List-Unsubscribe:<http://keepity.com>,<mailto:admin@keepity.com>");
$mail->Send();
}