当前位置: 首页>>代码示例>>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;未经允许,请勿转载。