ZF-8273: setReturnPath overwrites setFrom in Zend_Mail_Protocol_Smtp

Issue Type: Bug Created: 2009-11-10T02:21:43.000+0000 Last Updated: 2010-11-06T02:46:54.000+0000 Status: Closed Fix version(s): - 1.9.6 (24/Nov/09)

Reporter: Marcin Gil (mgil) Assignee: Marc Hodgins (mjh_ca) Tags: - Zend_Mail

Related issues: - ZF-7008



$mail = new Zend_Mail(); $mail->setFrom(''); $mail->setReturnPath(''); $mail->send( .. Zend_Mail_Transport_Smtp .. );

E-mail is being sent on instead of;

Zend_Mail_Transport_Smtp, line 203: $this->_connection->mail($this->_mail->getReturnPath());

Please fix.


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 "" instead of "". I understand that e-mail should be sent from "" with Return-Path header set to "" - 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 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


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.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.