问题描述
我正在尝试了解如何在使用PHPMailer时设置DSN。我知道在SMTP协议级别,DSN在RCPT TO之后指定,例如。 RCPT TO:NOTIFY = SUCCESS,FAILURE ORCPT = rfc822; [email protected]
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;[email protected]
此外,我想将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 = "[email protected]";
这篇关于如何为PHPMailer设置DSN(传送状态通知)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!