本文整理匯總了PHP中Zend_Mail::getReturnPath方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Mail::getReturnPath方法的具體用法?PHP Zend_Mail::getReturnPath怎麽用?PHP Zend_Mail::getReturnPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Mail
的用法示例。
在下文中一共展示了Zend_Mail::getReturnPath方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testReturnPath
public function testReturnPath()
{
$mail = new Zend_Mail();
$res = $mail->setBodyText('This is a test.');
$mail->setFrom('testmail@example.com', 'test Mail User');
$mail->setSubject('My Subject');
$mail->addTo('recipient1@example.com');
$mail->addTo('recipient2@example.com');
$mail->addBcc('recipient1_bcc@example.com');
$mail->addBcc('recipient2_bcc@example.com');
$mail->addCc('recipient1_cc@example.com', 'Example no. 1 for cc');
$mail->addCc('recipient2_cc@example.com', 'Example no. 2 for cc');
// First example: from and return-path should be equal
$mock = new Zend_Mail_Transport_Mock();
$mail->send($mock);
$this->assertTrue($mock->called);
$this->assertEquals($mail->getFrom(), $mock->returnPath);
// Second example: from and return-path should not be equal
$mail->setReturnPath('sender2@example.com');
$mock = new Zend_Mail_Transport_Mock();
$mail->send($mock);
$this->assertTrue($mock->called);
$this->assertNotEquals($mail->getFrom(), $mock->returnPath);
$this->assertEquals($mail->getReturnPath(), $mock->returnPath);
$this->assertNotEquals($mock->returnPath, $mock->from);
}
示例2: getFinalTransportForMail
public static function getFinalTransportForMail(Zend_Mail $mailObj, Zend_Mail_Transport_Abstract $transport)
{
$returnPath = $mailObj->getReturnPath();
if ($returnPath && $transport instanceof Zend_Mail_Transport_Sendmail) {
$transportOption = XenForo_Application::getOptions()->get('emailTransport', false);
if (!empty($transportOption['sendmailReturnPath']) && XenForo_Helper_Email::isEmailValid($returnPath)) {
$config = '-f "' . $returnPath . '"';
} else {
$config = null;
}
$transport = new Zend_Mail_Transport_Sendmail($config);
}
return $transport;
}