如何为PHPMailer设置DSN(传送状态通知)? [英] How to set DSN (Delivery Status Notification) for PHPMailer?

查看:194
本文介绍了如何为PHPMailer设置DSN(传送状态通知)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试了解如何在使用PHPMailer时设置DSN。我知道在SMTP协议级别,DSN在RCPT TO之后指定,例如。 RCPT TO:NOTIFY = SUCCESS,FAILURE ORCPT = rfc822; recipientemail@gmail.com

I'm trying to find out how to set DSN when using PHPMailer. I know at the SMTP Protocol level, the DSN is specified after RCPT TO, e.g. RCPT TO: NOTIFY=SUCCESS,FAILURE ORCPT=rfc822;recipientemail@gmail.com

此外,我想将DSN指向发件人地址以外的地址,如果可能。感谢任何指针,谢谢。

Also, I will like to direct the DSN to other than the sender address if that is possible. Appreciate any pointers, thanks.

推荐答案

我发现PHPMailer不支持DSN,所以我不得不修改class.smtp。 php本身。

I discovered that PHPMailer doesn't support DSN, so I had to amend class.smtp.php itself.

原始代码:

fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);

更改为:

 fputs($this->smtp_conn,"RCPT TO:<" . $to . "> NOTIFY=SUCCESS,FAILURE ORCPT=rfc822;" . $to ."" . $this->CRLF);

至于将DSN引导到发件人地址以外,可以通过定义:

As for directing DSN to other than sender address, this can be achieved by defining:

 $mail->Sender = "bounced@email.com";

这篇关于如何为PHPMailer设置DSN(传送状态通知)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆