当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Mime::boundary方法代码示例

本文整理汇总了PHP中Zend_Mime::boundary方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Mime::boundary方法的具体用法?PHP Zend_Mime::boundary怎么用?PHP Zend_Mime::boundary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Mime的用法示例。


在下文中一共展示了Zend_Mime::boundary方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testBoundary

 public function testBoundary()
 {
     // check boundary for uniqueness
     $m1 = new Zend_Mime();
     $m2 = new Zend_Mime();
     $this->assertNotEquals($m1->boundary(), $m2->boundary());
     // check instantiating with arbitrary boundary string
     $myBoundary = 'mySpecificBoundary';
     $m3 = new Zend_Mime($myBoundary);
     $this->assertEquals($m3->boundary(), $myBoundary);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:11,代码来源:MimeTest.php

示例2: getBodyHtml

 public function getBodyHtml($htmlOnly = false)
 {
     if ($htmlOnly) {
         return parent::getBodyHtml(true);
     }
     $mime = new Zend_Mime($this->getMimeBoundary());
     $boundaryLine = $mime->boundaryLine($this->EOL);
     $boundaryEnd = $mime->mimeEnd($this->EOL);
     $html = parent::getBodyHtml();
     $text = parent::getBodyText();
     $text->disposition = false;
     $html->disposition = false;
     $body = $boundaryLine . $text->getHeaders($this->EOL) . $this->EOL . $text->getContent($this->EOL) . $this->EOL . $boundaryLine . $html->getHeaders($this->EOL) . $this->EOL . $html->getContent($this->EOL) . $this->EOL . $boundaryEnd;
     $mp = new Zend_Mime_Part($body);
     $mp->type = Zend_Mime::MULTIPART_ALTERNATIVE;
     $mp->boundary = $mime->boundary();
     return $mp;
 }
开发者ID:jsiefer,项目名称:emarketing,代码行数:18,代码来源:Mail.php

示例3: send

 /**
  * Send a mail using this transport
  *
  * @param  Zend_Mail $mail
  * @access public
  * @return void
  * @throws Zend_Mail_Transport_Exception if mail is empty
  */
 public function send(Zend_Mail $mail)
 {
     $this->_isMultipart = false;
     $this->_mail = $mail;
     $this->_parts = $mail->getParts();
     $mime = $mail->getMime();
     // Build body content
     $this->_buildBody();
     // Determine number of parts and boundary
     $count = count($this->_parts);
     $boundary = null;
     if ($count < 1) {
         /**
          * @see Zend_Mail_Transport_Exception
          */
         // require_once 'Zend/Mail/Transport/Exception.php';
         throw new Zend_Mail_Transport_Exception('Empty mail cannot be sent');
     }
     if ($count > 1) {
         // Multipart message; create new MIME object and boundary
         $mime = new Zend_Mime($this->_mail->getMimeBoundary());
         $boundary = $mime->boundary();
     } elseif ($this->_isMultipart) {
         // multipart/alternative -- grab boundary
         $boundary = $this->_parts[0]->boundary;
     }
     // Determine recipients, and prepare headers
     $this->recipients = implode(',', $mail->getRecipients());
     $this->_prepareHeaders($this->_getHeaders($boundary));
     // Create message body
     // This is done so that the same Zend_Mail object can be used in
     // multiple transports
     $message = new Zend_Mime_Message();
     $message->setParts($this->_parts);
     $message->setMime($mime);
     $this->body = $message->generateMessage($this->EOL);
     // Send to transport!
     $this->_sendMail();
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:47,代码来源:Abstract.php

示例4: _buildBody

 /**
  * Generate MIME compliant message from the current configuration
  *
  * If both a text and HTML body are present, generates a
  * multipart/alternative Zend_Mime_Part containing the headers and contents
  * of each. Otherwise, uses whichever of the text or HTML parts present.
  *
  * The content part is then prepended to the list of Zend_Mime_Parts for
  * this message.
  *
  * @return void
  */
 protected function _buildBody()
 {
     $text = $this->_mail->getBodyText();
     $html = $this->_mail->getBodyHtml();
     $htmlAttachments = $this->_mail->getHtmlRelatedAttachments();
     $htmlAttachmentParts = $htmlAttachments->getParts();
     $hasHtmlRelatedParts = count($htmlAttachmentParts);
     if ($text && $html || $html && $hasHtmlRelatedParts && count($this->_parts)) {
         // Generate unique boundary for multipart/alternative
         $mime = new Zend_Mime(null);
         $boundaryLine = $mime->boundaryLine($this->EOL);
         $boundaryEnd = $mime->mimeEnd($this->EOL);
         $html->disposition = false;
         if ($hasHtmlRelatedParts) {
             $message = new Zend_Mime_Message();
             array_unshift($htmlAttachmentParts, $html);
             $message->setParts($htmlAttachmentParts);
             $htmlMime = $htmlAttachments->getMime();
             $message->setMime($htmlMime);
             $html = new Zend_Mime_Part($message->generateMessage($this->EOL, false));
             $html->boundary = $htmlMime->boundary();
             $html->type = Zend_Mime::MULTIPART_RELATED;
             $html->encoding = null;
         }
         $body = $boundaryLine;
         if ($text) {
             $text->disposition = false;
             $body .= $text->getHeaders($this->EOL) . $this->EOL . $text->getContent($this->EOL) . $this->EOL . $boundaryLine;
         }
         $body .= $html->getHeaders($this->EOL) . $this->EOL . $html->getContent($this->EOL) . $this->EOL . $boundaryEnd;
         $mp = new Zend_Mime_Part($body);
         $mp->type = Zend_Mime::MULTIPART_ALTERNATIVE;
         $mp->boundary = $mime->boundary();
         $this->_isMultipart = true;
         // Ensure first part contains text alternatives
         array_unshift($this->_parts, $mp);
         // Get headers
         $this->_headers = $this->_mail->getHeaders();
         return;
     }
     // If not multipart, then get the body
     if (false !== ($body = $this->_mail->getBodyHtml())) {
         array_unshift($this->_parts, $body);
         if ($hasHtmlRelatedParts) {
             $this->_mail->setType(Zend_Mime::MULTIPART_RELATED);
             foreach ($htmlAttachmentParts as $part) {
                 $this->_parts[] = $part;
             }
         }
     } elseif (false !== ($body = $this->_mail->getBodyText())) {
         array_unshift($this->_parts, $body);
     }
     if (!$body) {
         /**
          * @see Zend_Mail_Transport_Exception
          */
         require_once 'Zend/Mail/Transport/Exception.php';
         throw new Zend_Mail_Transport_Exception('No body specified');
     }
     // Get headers
     $this->_headers = $this->_mail->getHeaders();
     $headers = $body->getHeadersArray($this->EOL);
     foreach ($headers as $header) {
         // Headers in Zend_Mime_Part are kept as arrays with two elements, a
         // key and a value
         $this->_headers[$header[0]] = array($header[1]);
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:80,代码来源:Transport.php

示例5: getBoundary

 /**
  * Return the boundary used in the MIME multipart message
  *
  * @return string The boundary used in the MIME multipart message 
  */
 public function getBoundary()
 {
     return $this->_mime->boundary();
 }
开发者ID:dalinhuang,项目名称:popo,代码行数:9,代码来源:MediaEntry.php

示例6: send

 /**
  * Send a mail using this transport
  *
  * @param  OpenPGP_Zend_Mail $mail
  * @access public
  * @return void
  * @throws Zend_Mail_Transport_Exception if mail is empty
  */
 public function send(OpenPGP_Zend_Mail $mail)
 {
     $this->_isMultipart = false;
     $this->_mail = $mail;
     $this->_parts = $mail->getParts();
     $mime = $mail->getMime();
     // Build body content
     $this->_buildBody();
     // Determine number of parts and boundary
     $count = count($this->_parts);
     $boundary = null;
     if ($count < 1) {
         throw new Zend_Mail_Transport_Exception('Empty mail cannot be sent');
     }
     if ($count > 1) {
         // Multipart message; create new MIME object and boundary
         $mime = new Zend_Mime($this->_mail->getMimeBoundary());
         $boundary = $mime->boundary();
     } elseif ($this->_isMultipart) {
         // multipart/alternative -- grab boundary
         $boundary = $this->_parts[0]->boundary;
     }
     // Determine recipients, and prepare headers
     $this->recipients = implode(',', $mail->getRecipients());
     $this->_prepareHeaders($this->_getHeaders($boundary));
     // Create message body
     // This is done so that the same OpenPGP_Zend_Mail object can be used in
     // multiple transports
     $message = new Zend_Mime_Message();
     $message->setParts($this->_parts);
     $message->setMime($mime);
     $this->body = $message->generateMessage($this->EOL);
     ////////////////////////////////////////////////////////
     //                                                    //
     // ALPHAFIELDS 2012-11-03: ADDED PGP/MIME ENCRYPTION  //
     // USING lib/openpgp/opepgplib.php                    //
     //                                                    //
     ////////////////////////////////////////////////////////
     // get from globals (set in tiki-setup.php)
     global $openpgplib;
     $pgpmime_msg = $openpgplib->prepareEncryptWithZendMail($this->header, $this->body, $mail->getRecipients());
     $this->header = $pgpmime_msg[0];
     // set pgp/mime headers from result array
     $this->body = $pgpmime_msg[1];
     // set pgp/mime encrypted message body from result array
     ////////////////////////////////////////////////////////
     //                                                    //
     // ALPHAFIELDS 2012-11-03: ..END PGP/MIME ENCRYPTION  //
     //                                                    //
     ////////////////////////////////////////////////////////
     // Send to transport!
     $this->_sendMail();
 }
开发者ID:jkimdon,项目名称:cohomeals,代码行数:61,代码来源:OpenPGP_Zend_Mail_Transport_Abstract.php

示例7: getRawMessage

 /**
  * get raw message as string
  * 
  * @param Zend_Mail $mail
  * @param array $_additionalHeaders
  * @return string
  */
 public function getRawMessage(Zend_Mail $mail = NULL, $_additionalHeaders = array())
 {
     if ($mail !== NULL) {
         // this part is from Zend_Mail_Transport_Abstract::send()
         $this->_isMultipart = false;
         $this->_mail = $mail;
         $this->_parts = $mail->getParts();
         $mime = $mail->getMime();
         // Build body content
         $this->_buildBody();
         // Determine number of parts and boundary
         $count = count($this->_parts);
         $boundary = null;
         if ($count < 1) {
             /**
              * @see Zend_Mail_Transport_Exception
              */
             require_once 'Zend/Mail/Transport/Exception.php';
             throw new Zend_Mail_Transport_Exception('Mail is empty');
         }
         if ($count > 1) {
             // Multipart message; create new MIME object and boundary
             $mime = new Zend_Mime($this->_mail->getMimeBoundary());
             $boundary = $mime->boundary();
         } elseif ($this->_isMultipart) {
             // multipart/alternative -- grab boundary
             $boundary = $this->_parts[0]->boundary;
         }
         // Determine recipients, and prepare headers
         $this->recipients = implode(',', $mail->getRecipients());
         $this->_prepareHeaders($this->_getHeaders($boundary));
         // Create message body
         // This is done so that the same Zend_Mail object can be used in
         // multiple transports
         $message = new Zend_Mime_Message();
         $message->setParts($this->_parts);
         $message->setMime($mime);
         $this->body = $message->generateMessage($this->EOL);
     }
     $mailAsString = $this->getHeaders($_additionalHeaders) . $this->EOL . $this->getBody();
     // convert \n to \r\n
     $mailAsString = preg_replace("/(?<!\\r)\\n(?!\\r)/", "\r\n", $mailAsString);
     return $mailAsString;
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:51,代码来源:Transport.php


注:本文中的Zend_Mime::boundary方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。