ZF-195: Ability to set the MAIL FROM: to specify the Return-path when using SMTP
Description
The ability to specify the Return-path is quite useful, especially when wanting to direct bounces to a different address from the Sender address. From my research and testing the MAIL FROM command in SMTP allows the Return-path to be specifed.
It would be great if there was a way to specify the email address used by the following method in Mail/Transport/Smtp.php.
public function mail_from($from_email)
{
$this->_send('MAIL FROM: <'.$from_email.'>');
$this->_expect(250);
}
I hardcoded the $from_email and got the behaviour I was looking for. We really need to have a method that allows this to be set on the fly as individual emails are being sent - maybe something like $mail->setReturnPath()...
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2006-07-07T21:48:42.000+0000
Not a blocker, as the mail component can be used without this feature. However, it would be nice to have, and has been slated for the 0.2.0 release.
Posted by Gavin (gavin) on 2006-07-25T11:16:31.000+0000
It should be noted in the final documentation that using an email address in SMTP's MAIL FROM that differs from the mail header "From:" will increase the likelihood that anti-spam systems will file that email into the "junk/spam" folder.
Note that the mail header's "From:" can use any name in combination with an email address identical to whatever is desired for MAIL FROM. For example,
Thus, setting a different email address in MAIL FROM than in the "From:" mail header is not considered "best practice", and generally should be discouraged. The "Reply-To:" header solves the issue of someone replying to the bounce address, when the bounce address is using for the "From:" and "MAIL FROM".
Posted by Matthew Weier O'Phinney (matthew) on 2006-07-28T12:57:00.000+0000
Reply-To is a non-standard mail header; Return-Path is standard and addressed in RFC-2821 as the appropriate place to set an alternate address for bouncebacks.
I've updated Zend_Mail and Zend_Mail_Transport_Smtp to in commit 927 in SVN to address this; tests were also written and pass.