Login   Register  
PHP Classes
elePHPant
Icontem

Can we set a return path for bounced emails?

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      SMTP E-mail sending class  >  All threads  >  Can we set a return path for bounced emails?  >  (Un) Subscribe thread alerts  
Subject:Can we set a return path for bounced emails?
Summary:Can we set a return path for bounced emails?
Messages:2
Author:Roy Martins
Date:2013-05-13 20:22:13
Update:2013-05-14 04:44:07
 

  1. Can we set a return path for bounced emails?   Reply   Report abuse  
Picture of Roy Martins
Roy Martins
2013-05-13 20:22:13
I'm attempting to have bounced emails go to another email address, however, they are being sent to the email being sent from. This is what I've done (at the bottom of test_smtp.php:

array(
"From: Myreturnemailaddress",
"Reply-To: Myreturnemailaddress",
"Return-Path: Myreturnemailaddress",
"To: $to",
"Subject: TEST",
"Date: ".strftime("%a, %d %b %Y %H:%M:%S %Z")
),

Bounced messages are still being sent to the original SMTP provider email address that I've sent the email from. Can you suggest how I can change this? This can be done (and works) with the traditional PHP Mail Function:

mail("to@example.com", "subject", "body of message", "From: sender@example.com", "-fsender@example.com");

The part of the code that does this is "-fsender@example.com".

Any help would be appreciated.

  2. Re: Can we set a return path for bounced emails?   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2013-05-14 04:44:07 - In reply to message 1 from Roy Martins
The Return-Path header is irrelevant. It is set by the SMTP server, not by the SMTP client sending the message.

You should use the MIME message class instead in conjunction with the SMTP to set the protocol information correctly using the Return-Path. It does the necessary emulation to make the messages bounce to the address you specify with that header.

http://www.phpclasses.org/mimemessage