當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Mail::clearDefaultFrom方法代碼示例

本文整理匯總了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());
 }
開發者ID:jsnshrmn,項目名稱:Suma,代碼行數:9,代碼來源:MailTest.php

示例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());
     }
 }
開發者ID:hugi2002,項目名稱:mylibrary,代碼行數:56,代碼來源:Sender.php


注:本文中的Zend_Mail::clearDefaultFrom方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。