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


PHP Horde_Mime_Part::isBasePart方法代碼示例

本文整理匯總了PHP中Horde_Mime_Part::isBasePart方法的典型用法代碼示例。如果您正苦於以下問題:PHP Horde_Mime_Part::isBasePart方法的具體用法?PHP Horde_Mime_Part::isBasePart怎麽用?PHP Horde_Mime_Part::isBasePart使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Horde_Mime_Part的用法示例。


在下文中一共展示了Horde_Mime_Part::isBasePart方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: send

 /**
  * Sends this message.
  *
  * @param Mail $mailer     A Mail object.
  * @param boolean $resend  If true, the message id and date are re-used;
  *                         If false, they will be updated.
  * @param boolean $flowed  Send message in flowed text format.
  *
  * @throws Horde_Mime_Exception
  */
 public function send($mailer, $resend = false, $flowed = true)
 {
     /* Add mandatory headers if missing. */
     $has_header = $this->_headers->getValue('Message-ID');
     if (!$resend || !$has_header) {
         if ($has_header) {
             $this->_headers->removeHeader('Message-ID');
         }
         $this->_headers->addMessageIdHeader();
     }
     if (!$this->_headers->getValue('User-Agent')) {
         $this->_headers->addUserAgentHeader();
     }
     $has_header = $this->_headers->getValue('Date');
     if (!$resend || !$has_header) {
         if ($has_header) {
             $this->_headers->removeHeader('Date');
         }
         $this->_headers->addHeader('Date', date('r'));
     }
     if (isset($this->_base)) {
         $basepart = $this->_base;
     } else {
         /* Send in flowed format. */
         if ($flowed && !empty($this->_body)) {
             $flowed = new Horde_Text_Flowed($this->_body->getContents(), $this->_body->getCharset());
             $flowed->setDelSp(true);
             $this->_body->setContentTypeParameter('format', 'flowed');
             $this->_body->setContentTypeParameter('DelSp', 'Yes');
             $this->_body->setContents($flowed->toFlowed());
         }
         /* Build mime message. */
         $body = new Horde_Mime_Part();
         if (!empty($this->_body) && !empty($this->_htmlBody)) {
             $body->setType('multipart/alternative');
             $this->_body->setDescription(Horde_Mime_Translation::t("Plaintext Version of Message"));
             $body->addPart($this->_body);
             $this->_htmlBody->setDescription(Horde_Mime_Translation::t("HTML Version of Message"));
             $body->addPart($this->_htmlBody);
         } elseif (!empty($this->_htmlBody)) {
             $body = $this->_htmlBody;
         } elseif (!empty($this->_body)) {
             $body = $this->_body;
         }
         if (count($this->_parts)) {
             $basepart = new Horde_Mime_Part();
             $basepart->setType('multipart/mixed');
             $basepart->isBasePart(true);
             if ($body) {
                 $basepart->addPart($body);
             }
             foreach ($this->_parts as $mime_part) {
                 $basepart->addPart($mime_part);
             }
         } else {
             $basepart = $body;
             $basepart->isBasePart(true);
         }
     }
     $basepart->setHeaderCharset($this->_charset);
     /* Build recipients. */
     $recipients = clone $this->_recipients;
     foreach (array('to', 'cc') as $header) {
         $recipients->add($this->_headers->getOb($header));
     }
     if ($this->_bcc) {
         $recipients->add($this->_bcc);
     }
     /* Trick Horde_Mime_Part into re-generating the message headers. */
     $this->_headers->removeHeader('MIME-Version');
     /* Send message. */
     $recipients->unique();
     $basepart->send($recipients->writeAddress(), $this->_headers, $mailer);
     /* Remember the basepart */
     $this->_base = $basepart;
 }
開發者ID:pzhu2004,項目名稱:moodle,代碼行數:86,代碼來源:Mail.php

示例2: testMultipartDigest

 public function testMultipartDigest()
 {
     $part = new Horde_Mime_Part();
     $part->setType('multipart/digest');
     $part->isBasePart(true);
     $part2 = new Horde_Mime_Part();
     $part2->setType('message/rfc822');
     $part2->setContents(file_get_contents(__DIR__ . '/fixtures/sample_msg4.txt'));
     $part[] = $part2;
     $this->assertStringMatchesFormat("Content-Type: multipart/digest; boundary=\"=_%s\"\nMIME-Version: 1.0\n\nThis message is in MIME format.\n\n--=_%s\n\nMessage-ID: <asdl8ahwhoadsadl@example.com>\nDate: Tue, 07 Jul 2013 10:21:48 -0600\nFrom: \"Test Q. User\" <test@example.com>\nTo: foo@example.com\nSubject: Test\nMIME-Version: 1.0\n\n\nTest.\n\n--=_%s--", $part->toString(array('headers' => true)));
 }
開發者ID:x59,項目名稱:horde-mime,代碼行數:11,代碼來源:PartTest.php


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