PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, July 6, 2022

[FIXED] How to set DSN (Delivery Status Notification) for PHPMailer?

 July 06, 2022     email, php, phpmailer, smtp     No comments   

Issue

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

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


Solution

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

Original Code:

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

Change to:

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

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

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


Answered By - Joshua
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing