你能告訴我,爲什麼我設置ReturnPath這樣使用的Zend_Mail接收到的電子郵件返回路徑頭使用SMTP服務區域(我在Gmail中查看它們):問題與使用Zend_Mail返回路徑
Return-Path: <[email protected]> //I think this is added by server
.....
Return-Path: [email protected] //I think this is cause by returnPath
我設定的回報-path這樣的:
$mailer->setReturnPath('[email protected]');
我集運輸這樣的:
$emailConfig = $this->getOption('email');
$transport = new Zend_Mail_Transport_Smtp($emailConfig['server'], $emailConfig);
Zend_Mail::setDefaultTransport($transport);
如果我不設置ReturnPath這樣的服務器添加換貨政...路徑與我設置的From標題相同。 這是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;
}
難道你在回答之前寫下問題? – Oleg
除了addHeader是不正確的方式來設置標準頭,並會失敗。 – Oleg
所以我不知道爲什麼它爲我工作 –