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


PHP Swift_Message::toByteStream方法代码示例

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


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

示例1: toByteStream

 /**
  * Write this message to a {@link Swift_InputByteStream}.
  *
  * @param Swift_InputByteStream $is
  */
 public function toByteStream(Swift_InputByteStream $is)
 {
     $this->saveMessage();
     $this->doSign();
     parent::toByteStream($is);
     $this->restoreMessage();
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:12,代码来源:SignedMessage.php

示例2: testWritingMessageToByteStreamTwiceUsingAFileAttachment

 public function testWritingMessageToByteStreamTwiceUsingAFileAttachment()
 {
     $message = new Swift_Message();
     $message->setSubject('test subject');
     $message->setTo('user@domain.tld');
     $message->setCc('other@domain.tld');
     $message->setFrom('user@domain.tld');
     $attachment = Swift_Attachment::fromPath($this->_attFile);
     $message->attach($attachment);
     $message->setBody('HTML part', 'text/html');
     $id = $message->getId();
     $date = preg_quote(date('r', $message->getDate()), '~');
     $boundary = $message->getBoundary();
     $streamA = new Swift_ByteStream_ArrayByteStream();
     $streamB = new Swift_ByteStream_ArrayByteStream();
     $pattern = '~^' . 'Message-ID: <' . $id . '>' . "\r\n" . 'Date: ' . $date . "\r\n" . 'Subject: test subject' . "\r\n" . 'From: user@domain.tld' . "\r\n" . 'To: user@domain.tld' . "\r\n" . 'Cc: other@domain.tld' . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-Type: multipart/mixed;' . "\r\n" . ' boundary="' . $boundary . '"' . "\r\n" . "\r\n\r\n" . '--' . $boundary . "\r\n" . 'Content-Type: text/html; charset=utf-8' . "\r\n" . 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . "\r\n" . 'HTML part' . "\r\n\r\n" . '--' . $boundary . "\r\n" . 'Content-Type: ' . $this->_attFileType . '; name=' . $this->_attFileName . "\r\n" . 'Content-Transfer-Encoding: base64' . "\r\n" . 'Content-Disposition: attachment; filename=' . $this->_attFileName . "\r\n" . "\r\n" . preg_quote(base64_encode(file_get_contents($this->_attFile)), '~') . "\r\n\r\n" . '--' . $boundary . '--' . "\r\n" . '$~D';
     $message->toByteStream($streamA);
     $message->toByteStream($streamB);
     $this->assertPatternInStream($pattern, $streamA);
     $this->assertPatternInStream($pattern, $streamB);
 }
开发者ID:dosh93,项目名称:shop,代码行数:21,代码来源:Bug38Test.php

示例3: append_message

 /**
  * Append a message to a mailbox
  *
  * @param string $mailbox
  * @param string|\Swift_Message $data
  * @param string $flags See set_message_flag
  * @return boolean
  */
 public function append_message($mailbox, $data, $flags = "")
 {
     if ($data instanceof \Swift_Message) {
         $tmpfile = \GO\Base\Fs\File::tempFile();
         $is = new \Swift_ByteStream_FileByteStream($tmpfile->path(), true);
         $data->toByteStream($is);
         unset($data);
         unset($is);
         if (!$this->append_start($mailbox, $tmpfile->size(), $flags)) {
             return false;
         }
         $fp = fopen($tmpfile->path(), 'r');
         while ($line = fgets($fp, 1024)) {
             if (!$this->append_feed($line)) {
                 return false;
             }
         }
         fclose($fp);
         $tmpfile->delete();
     } else {
         if (!$this->append_start($mailbox, strlen($data), $flags)) {
             return false;
         }
         if (!$this->append_feed($data)) {
             return false;
         }
     }
     $this->append_feed("\r\n");
     return $this->append_end();
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:38,代码来源:Imap.php


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