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


PHP Zend_Mime类代码示例

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


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

示例1: _encodeHeader

 /**
  * Encode header fields
  *
  * Encodes header content according to RFC1522 if it contains non-printable
  * characters.
  *
  * @param  string $value
  * @return string
  */
 protected function _encodeHeader($value)
 {
     if (\Zend_Mime::isPrintable($value)) {
         return $value;
     } else {
         /**
          * Next strings fixes the problems
          * According to RFC 1522 (http://www.faqs.org/rfcs/rfc1522.html)
          */
         $quotedValue = '';
         $count = 1;
         for ($i = 0; strlen($value) > $i; $i++) {
             if ($value[$i] == '?' or $value[$i] == '_' or $value[$i] == ' ') {
                 $quotedValue .= str_replace(array('?', ' ', '_'), array('=3F', '=20', '=5F'), $value[$i]);
             } else {
                 $quotedValue .= $this->encodeQuotedPrintable($value[$i]);
             }
             if (strlen($quotedValue) > $count * \Zend_Mime::LINELENGTH) {
                 $count++;
                 $quotedValue .= "?=\n =?" . $this->_charset . '?Q?';
             }
         }
         return '=?' . $this->_charset . '?Q?' . $quotedValue . '?=';
     }
 }
开发者ID:sb15,项目名称:utils,代码行数:34,代码来源:EmailFix.php

示例2: _encodeHeader

 /**
  * Encode header fields
  *
  * Encodes header content according to RFC1522 if it contains non-printable
  * characters.
  *
  * @param  string $value
  * @return string
  */
 protected function _encodeHeader($value)
 {
     if (Zend_Mime::isPrintable($value)) {
         return $value;
     } else {
         $base64Value = base64_encode($value);
         return "=?" . $this->_charset . "?B?" . $base64Value . "?=";
     }
 }
开发者ID:kangza,项目名称:hagtag,代码行数:18,代码来源:Mail.php

示例3: 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

示例4: _encodeHeader

 /**
  * Encode header fields
  *
  * Encodes header content according to RFC1522 if it contains non-printable
  * characters.
  *
  * @param  string $value
  * @return string
  */
 protected function _encodeHeader($value)
 {
     if (Zend_Mime::isPrintable($value)) {
         return $value;
     } else {
         $quotedValue = Zend_Mime::encodeQuotedPrintable($value, 400);
         $quotedValue = str_replace(array('?', ' ', '_'), array('=3F', '=20', '=5F'), $quotedValue);
         return '=?' . $this->_charset . '?Q?' . $quotedValue . '?=';
     }
 }
开发者ID:BGCX261,项目名称:zhongyycode-svn-to-git,代码行数:19,代码来源:Mail.php

示例5: _encodeHeader

 protected function _encodeHeader($value)
 {
     if (Zend_Mime::isPrintable($value)) {
         return $value;
     } else {
         $quotedValue = Zend_Mime::encodeQuotedPrintable($value);
         $quotedValue = str_replace(array('?', ' '), array('=3F', '=20'), $quotedValue);
         $quotedValue = rawurlencode($quotedValue);
         $quotedValue = str_replace('%3D%0A', '', $quotedValue);
         $quotedValue = rawurldecode($quotedValue);
         $quotedValue = '=?' . $this->_charset . '?Q?' . $quotedValue . '?=';
     }
     return $quotedValue;
 }
开发者ID:rdallasgray,项目名称:bbx,代码行数:14,代码来源:Mail.php

示例6: indexAction

 public function indexAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     //$value = 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩъыьЭЮЯ';
     $value = 'いろはにほへとちりぬるをわかよたれそつねならむ';
     echo "<pre>B-1. Zend_Mime::encodeBase64Header:<br>\r\n";
     echo Zend_Mime::encodeBase64Header($value, $this->_charset, $this->_len, $this->_feed);
     echo "\r\n<br><br>";
     echo "Q-1. Zend_Mime::encodeQuotedPrintableHeader:<br>\r\n";
     echo Zend_Mime::encodeQuotedPrintableHeader($value, $this->_charset, $this->_len, $this->_feed);
     echo "\r\n<br><br>";
     mb_internal_encoding($this->_charset);
     echo "B-2. Base64 by mb_encode_mimeheader:<br>\r\n";
     echo mb_encode_mimeheader($value, $this->_charset, 'B', $this->_feed, $this->_len);
     echo "\r\n<br><br>";
     echo "Q-2. QuotedPrintable by mb_encode_mimeheader:<br>\r\n";
     echo mb_encode_mimeheader($value, $this->_charset, 'Q', $this->_feed, $this->_len);
     echo "</pre>\r\n";
 }
开发者ID:Tony133,项目名称:zf-web,代码行数:19,代码来源:MimeController.php

示例7: setTypeAndDispositionForAttachment

 /**
  * set part type and disposition (with name if available)
  * 
  * @param string $type
  * @param string $name
  */
 public function setTypeAndDispositionForAttachment($type, $name = NULL)
 {
     $this->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
     $partTypeString = $type;
     if ($name) {
         $name = Zend_Mime::encodeQuotedPrintableHeader($name, 'utf-8');
         $partTypeString .= '; name="' . $name . '"';
         $this->disposition .= '; filename="' . $name . '"';
     }
     $this->type = $partTypeString;
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:17,代码来源:Part.php

示例8: _encodeHeader

 /**
  * Encode header fields
  *
  * Encodes header content according to RFC1522 if it contains non-printable
  * characters.
  *
  * @param  string $value
  * @return string
  */
 protected function _encodeHeader($value)
 {
     if (Zend_Mime::isPrintable($value)) {
         return $value;
     } elseif ($this->_encodingOfHeaders === Zend_Mime::ENCODING_QUOTEDPRINTABLE) {
         $quotedValue = Zend_Mime::encodeQuotedPrintable($value);
         $quotedValue = str_replace(array('?', ' ', '_'), array('=3F', '=20', '=5F'), $quotedValue);
         return '=?' . $this->_charset . '?Q?' . $quotedValue . '?=';
     } elseif ($this->_encodingOfHeaders === Zend_Mime::ENCODING_BASE64) {
         return '=?' . $this->_charset . '?B?' . Zend_Mime::encodeBase64($value) . '?=';
     } else {
         /**
          * @todo 7Bit and 8Bit is currently handled the same way.
          */
         return $value;
     }
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:26,代码来源:Mail.php

示例9: getContent

 /**
  * Get the Content of the current Mail Part in the given encoding.
  *
  * @return String
  */
 public function getContent()
 {
     return Zend_Mime::encode($this->_content, $this->encoding);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:9,代码来源:Part.php

示例10: 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

示例11: getContent

 /**
  * Get the Content of the current Mime Part in the given encoding.
  *
  * @return String
  */
 public function getContent($EOL = Zend_Mime::LINEEND)
 {
     if ($this->_isStream) {
         return stream_get_contents($this->getEncodedStream());
     } else {
         return Zend_Mime::encode($this->_content, $this->encoding, $EOL);
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:13,代码来源:Part.php

示例12: testBase64

 public function testBase64()
 {
     $content = str_repeat("И™ѓњ)И™ѓњ)И™ѓ", 4);
     $encoded = Zend_Mime::encodeBase64($content);
     $this->assertEquals($content, base64_decode($encoded));
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:6,代码来源:MimeTest.php

示例13: 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

示例14: testLineLengthInQuotedPrintableHeaderEncoding

 /**
  * @group ZF-1688
  */
 public function testLineLengthInQuotedPrintableHeaderEncoding()
 {
     $subject = "Alle meine Entchen schwimmen in dem See, schwimmen in dem See, Köpfchen in das Wasser, Schwänzchen in die Höh!";
     $encoded = Zend_Mime::encodeQuotedPrintableHeader($subject, "UTF-8", 100);
     foreach (explode(Zend_Mime::LINEEND, $encoded) as $line) {
         if (strlen($line) > 100) {
             $this->fail("Line '" . $line . "' is " . strlen($line) . " chars long, only 100 allowed.");
         }
     }
     $encoded = Zend_Mime::encodeQuotedPrintableHeader($subject, "UTF-8", 40);
     foreach (explode(Zend_Mime::LINEEND, $encoded) as $line) {
         if (strlen($line) > 40) {
             $this->fail("Line '" . $line . "' is " . strlen($line) . " chars long, only 40 allowed.");
         }
     }
 }
开发者ID:netvlies,项目名称:zf,代码行数:19,代码来源:MimeTest.php

示例15: getDecodedContent

 /**
  * Get the Content of the current Mime Part in the given decoding.
  *
  * @return String
  */
 public function getDecodedContent()
 {
     if ($this->_isStream) {
         $result = stream_get_contents($this->getDecodedStream());
     } else {
         // Zend_Mime::decode not yet implemented
         $result = Zend_Mime::decode($this->_content, $this->encoding);
     }
     return $result;
 }
开发者ID:,项目名称:,代码行数:15,代码来源:


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