你能告诉我为什么我设置returnPath使用zend_mail接收的电子邮件必须返回路径标题(我在gmail中查看它们)使用smtp传输:
Return-Path: <bounce@domain.com> //I think this is added by server
.....
Return-Path: bounce@domain.com //I think this is cause by returnPath$mailer->setReturnPath('bounce@domain.com');$emailConfig = $this->getOption('email');
$transport = new Zend_Mail_Transport_Smtp($emailConfig['server'], $emailConfig);
Zend_Mail::setDefaultTransport($transport);如果我没有设置returnPath服务器,添加returnPath与我在header中设置的相同。这是Zend_Mail中的一个bug还是什么?我的理解是,服务器将添加与在MAIL_FROM中使用的相同的返回路径报头,setReturnPath不应该手动添加报头,而是只保存它以供MAIL_FROM使用?It在Zend_Mail_Transport_Smtp更改代码注释行中:
/**
* Sets the Return-Path header of the message
*
* @param string $email
* @return Zend_Mail Provides fluent interface
* @throws Zend_Mail_Exception if set multiple times
*/
public function setReturnPath($email)
{
if ($this->_returnPath === null) {
$email = $this->_filterEmail($email);
$this->_returnPath = $email;
//This line presents in Zend_Framework
//I comment this like I get only one return-path the same as
//set using setReturnPath method of Zend_Mail
//$this->_storeHeader('Return-Path', $email, false);
} else {
/**
* @see Zend_Mail_Exception
*/
require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('Return-Path Header set twice');
}
return $this;
} 发布于 2015-11-25 20:10:24
在Zend中,您可以通过显式选择传输将必要的附加参数传递给sendmail:
$tr = new Zend_Mail_Transport_Sendmail('-fmail@example.com');
$_mail = new Zend_Mail();
$_mail->setDefaultTransport($tr);发布于 2013-01-09 19:58:52
试试这个:
$mail->addHeader('Return-path', 'email@address.com'); https://stackoverflow.com/questions/14230023
复制相似问题