ZF-8273: setReturnPath overwrites setFrom in Zend_Mail_Protocol_Smtp
Description
$mail = new Zend_Mail(); $mail->setFrom('sender@email.com'); $mail->setReturnPath('returns@email.com'); $mail->send( .. Zend_Mail_Transport_Smtp .. );
E-mail is being sent on returns@email.com instead of sender@email.com;
Zend_Mail_Transport_Smtp, line 203: $this->_connection->mail($this->_mail->getReturnPath());
Please fix.
Comments
Posted by Satoru Yoshida (satoruyoshida) on 2009-11-14T04:59:40.000+0000
Hi, Marcin.
Do you mean you find mail returns back when some error is happened? Or, you find [from] address is changed on your mailer?
Posted by Marcin Gil (mgil) on 2009-11-14T05:06:43.000+0000
Hi Satoru,
I mean that e-mail is sent from "returns@email.com" instead of "sender@email.com". I understand that e-mail should be sent from "sender@email.com" with Return-Path header set to "returns@email.com" - in case of error. Do I understand incorrectly?
Cheers, Marcin
Posted by Satoru Yoshida (satoruyoshida) on 2009-11-15T05:37:38.000+0000
I change code in SVN r18988 (trunk), 18989 (1.9 branch) .
You are correct, Marcin. For your purpose, getReturnPath() should be replaced with getFrom().
And I have a sadly information I must notice you :-( As it is pointed out in ZF-7008, setReturnPath can not work fine now.
The function is under consideration how to fix.
Posted by Janis Lünne (luenne) on 2010-07-27T05:46:19.000+0000
Hi Satoru, hi Marcin,
unfortunately this is broken now. The Return-Path has to be used as MAIL FROM: in the SMTP transport. So please undo your replacement of getReturnPath() with getFrom(), because it was working correctly before.
Thanks, Janis
Posted by Dolf Schimmel (Freeaqingme) (freak) on 2010-07-27T05:52:05.000+0000
Please present some code to reproduce, and describe the problem with that code. Thanks.
Posted by Janis Lünne (luenne) on 2010-07-28T07:51:50.000+0000
Zend_Mail_Transport_Smtp, line 203: was (correct): $this->_connection->mail($this->_mail->getReturnPath()); is now (incorrect): $this->_connection->mail($this->_mail->getFrom());
This results in always using the "Body-From" (From:-Header), as "Envelope-From" ("MAIL FROM:" SMTP command) and removes the possibility to use different Envelope-From and Body-From Addresses.
See RFC 2821 and http://en.wikipedia.org/wiki/Bounce_address for reference.
Posted by Dolf Schimmel (Freeaqingme) (freak) on 2010-07-28T07:54:42.000+0000
Ouch. Will fix tonight.
Posted by Stephan Wentz (swentz) on 2010-08-09T03:59:41.000+0000
bump
It's still not fixed in trunk - and it breaks our mail code ;-)
Posted by Marc Hodgins (mjh_ca) on 2010-11-06T02:46:54.000+0000
ZF-8988 was opened because this was not actually a bug and the "solution" broke Zend_Mail to not be compliant with the RFC with the SMTP transport.
Closing this issue to avoid confusion -- see ZF-8988 for the fix.