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


PHP Swift_Mime_Message::toByteStream方法代码示例

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


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

示例1: streamMessage

 /** Stream the contents of the message over the buffer */
 protected function streamMessage(Swift_Mime_Message $message)
 {
     $this->buffer->setWriteTranslations(array("\r\n." => "\r\n.."));
     try {
         $message->toByteStream($this->buffer);
         $this->buffer->flushBuffers();
     } catch (Swift_TransportException $e) {
         $this->throwException($e);
     }
     $this->buffer->setWriteTranslations(array());
     $this->executeCommand("\r\n.\r\n", array(250));
 }
开发者ID:jaeger-app,项目名称:swiftmailer,代码行数:13,代码来源:AbstractSmtpTransport.php

示例2: _doSend

 /**
  * do send through the API
  *
  * @param Swift_Mime_Message $message
  * @param string[] &$failedRecipients to collect failures by-reference
  * @return AWSResponse
  */
 protected function _doSend(Swift_Mime_Message $message, &$failedRecipients = null)
 {
     $date = date('D, j F Y H:i:s O');
     if (function_exists('hash_hmac') and in_array('sha1', hash_algos())) {
         $hmac = base64_encode(hash_hmac('sha1', $date, $this->AWSSecretKey, true));
     } else {
         $hmac = $this->calculate_RFC2104HMAC($date, $this->AWSSecretKey);
     }
     $auth = "AWS3-HTTPS AWSAccessKeyId=" . $this->AWSAccessKeyId . ", Algorithm=HmacSHA1, Signature=" . $hmac;
     $host = parse_url($this->endpoint, PHP_URL_HOST);
     $path = parse_url($this->endpoint, PHP_URL_PATH);
     $fp = fsockopen('ssl://' . $host, 443, $errno, $errstr, 30);
     if (!$fp) {
         throw new AWSConnectionError("{$errstr} ({$errno})");
     }
     $socket = new ChunkedTransferSocket($fp, $host, $path);
     $socket->header("Date", $date);
     $socket->header("X-Amzn-Authorization", $auth);
     $socket->write("Action=SendRawEmail&RawMessage.Data=");
     $ais = new Swift_AWSInputByteStream($socket);
     $message->toByteStream($ais);
     $ais->flushBuffers();
     $result = $socket->read();
     return $result;
 }
开发者ID:rhymix,项目名称:rhymix,代码行数:32,代码来源:AWSTransport.php


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