本文整理汇总了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;
}