本文整理汇总了PHP中Zend_Mail::clearDefaultFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Mail::clearDefaultFrom方法的具体用法?PHP Zend_Mail::clearDefaultFrom怎么用?PHP Zend_Mail::clearDefaultFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Mail
的用法示例。
在下文中一共展示了Zend_Mail::clearDefaultFrom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDefaultFrom
public function testDefaultFrom()
{
Zend_Mail::setDefaultFrom('john@example.com', 'John Doe');
$this->assertEquals(array('email' => 'john@example.com', 'name' => 'John Doe'), Zend_Mail::getDefaultFrom());
Zend_Mail::clearDefaultFrom();
$this->assertEquals(null, Zend_Mail::getDefaultFrom());
Zend_Mail::setDefaultFrom('john@example.com');
$this->assertEquals(array('email' => 'john@example.com', 'name' => null), Zend_Mail::getDefaultFrom());
}
示例2: send
function send()
{
//print_r($this->_templete_params);
try {
$html = $this->getBodyContent();
$mail = new Zend_Mail('utf-8');
$mail->clearDefaultFrom();
$mail->setBodyHtml($html);
$mail->addHeader('mailedby', WEB_HOST);
// $mail->addHeader('X-MailGenerator', 'MyCoolApplication');
$mail->setFrom(App_Env::getSystemEmail(), App_Env::getSystemEmailFrom());
$this->setSender(App_Env::getSystemEmail());
foreach ($this->_to as $email) {
$mail->addTo($email);
}
$this->addBcc(App_Env::getBccEmail());
if (count($this->_bcc) > 0) {
foreach ($this->_bcc as $email) {
$mail->addBcc($email);
}
}
if ($this->getTemplateId() == Sys_Model_Template::EMAIL_NEW_ISSUE) {
$this->_subject = str_replace("[ISSUE_NUMBER]", $this->getParam("ISSUE_NUMBER"), $this->_subject);
} elseif ($this->getTemplateId() == Sys_Model_Template::EMAIL_REPLY_ISSUE) {
$this->_subject = str_replace("[ISSUE_NUMBER]", $this->getParam("ISSUE_NUMBER"), $this->_subject);
}
$subject = $this->_subject;
$mail->setSubject($this->_subject);
$log = App_Log::get()->maillog($this);
// บวก link
$id = $log->id;
$skey = $log->skey;
$sid = base64_encode("{$id}&{$skey}&" . join(",", $this->_to));
$onlineurl = WEB_DOMAIN . "/e?sid={$sid}";
$html = "If you are having trouble reading this email, <a href='{$onlineurl}'>read the online version </a>." . $html;
$mail->setBodyHtml($html);
$this->_mail = $mail;
$mail->send();
// ส่ง notify admin
if ($this->_sendNotify and in_array($this->getTemplateId(), array(Sys_Model_Template::EMAIL_NEW_ISSUE, Sys_Model_Template::EMAIL_REPLY_ISSUE, Sys_Model_Template::EMAIL_ACCOUNT_INFO, Sys_Model_Template::EMAIL_INVOICE, Sys_Model_Template::EMAIL_PURCHASE_ORDER))) {
$notifier = new App_Mail_Notifier();
$notifier->setSubject($subject);
$notifier->setMailURL($onlineurl);
$notifier->setAdminURL($this->getAdminURL());
$notifier->send();
}
// echo "notify";
// exit();
} catch (Exception $e) {
// $this->view->stat = 'error';
// $this->view->msg = $e->getMessage ();
echo "error";
echo $e->getMessage();
// throw new Exception($e->getMessage());
}
}