你能告诉我为什么我使用 zend_mail 设置 returnPath 收到的电子邮件必须使用 smtp trasport 返回路径标题(我在 gmail 中查看它们):
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 服务器,则添加与我设置 From 标头相同的 returnPath。它是 Zend_Mail 中的错误还是什么?我的理解是,服务器将添加与 MAIL_FROM 中使用的返回路径头相同的返回路径标头,并且 setReturnPath 不应在菜单上添加标头,而仅将其保存以用于 MAIL_FROM?它在 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;
}