當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。