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


PHP Email::getHeaders方法代码示例

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


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

示例1: send

 /**
  * 
  * @author Anand Thakkar <anand@phpconsultant.co>
  * @param Email $email
  * @throws \App\Network\Email\Mandrill_ErrorS
  */
 public function send(Email $email)
 {
     $headers = $email->getHeaders(['from', 'sender', 'replyTo', 'to', 'cc', 'bcc']);
     try {
         $message = array('html' => '<p>This is the body of the Email</p>', 'text' => 'This is the body of the Email', 'subject' => 'Testing mandrill Application', 'from_email' => $headers['From'], 'from_name' => $headers['Sender'], 'to' => array(array('email' => $headers['To'], 'type' => 'to')), 'headers' => array('Reply-To' => $headers['Reply-To']), 'important' => false);
         $async = false;
         $ip_pool = 'Main Pool';
         $send_at = FALSE;
         $result = $this->mandrill->messages->send($message, $async, $ip_pool, $send_at);
     } catch (Mandrill_Error $e) {
         echo 'A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage();
         //throw $e;
     }
 }
开发者ID:hunnybohara,项目名称:coin_bates,代码行数:20,代码来源:MandrillTransport.php

示例2: send

 /**
  * 
  * @author Anand Thakkar <anand@phpconsultant.co>
  * @param Email $email
  * @throws \App\Network\Email\Mandrill_ErrorS
  */
 public function send(Email $email)
 {
     $headers = $email->getHeaders(['from', 'sender', 'replyTo', 'to', 'cc', 'bcc']);
     try {
         pr($email);
         die('we are here');
         $message = array('html' => '<p>Example HTML content</p>', 'text' => 'Example text content', 'subject' => 'example subject', 'from_email' => $headers['From'], 'from_name' => $headers['Sender'], 'to' => array(array('email' => $headers['To'], 'type' => 'to')), 'headers' => array('Reply-To' => $headers['Reply-To']), 'important' => false);
         $async = false;
         $ip_pool = 'Main Pool';
         $send_at = FALSE;
         $result = $this->mandrill->messages->send($message, $async, $ip_pool, $send_at);
     } catch (Mandrill_Error $e) {
         echo 'A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage();
         throw $e;
     }
 }
开发者ID:hunnybohara,项目名称:coin_bates,代码行数:22,代码来源:MandrillTransport.php

示例3: send

 /**
  * Send mail
  *
  * @param \Cake\Network\Email\Email $email Cake Email
  * @return array
  */
 public function send(Email $email)
 {
     $eol = PHP_EOL;
     if (isset($this->_config['eol'])) {
         $eol = $this->_config['eol'];
     }
     $headers = $email->getHeaders(array('from', 'sender', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'bcc'));
     $to = $headers['To'];
     unset($headers['To']);
     foreach ($headers as $key => $header) {
         $headers[$key] = str_replace(array("\r", "\n"), '', $header);
     }
     $headers = $this->_headersToString($headers, $eol);
     $subject = str_replace(array("\r", "\n"), '', $email->subject());
     $to = str_replace(array("\r", "\n"), '', $to);
     $message = implode($eol, $email->message());
     $params = isset($this->_config['additionalParameters']) ? $this->_config['additionalParameters'] : null;
     $this->_mail($to, $subject, $message, $headers, $params);
     return array('headers' => $headers, 'message' => $message);
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:26,代码来源:MailTransport.php

示例4: testBodyEncodingIso2022JpMs

 /**
  * Tests that the body is encoded using the configured charset (Japanese irregular encoding, but sometime use this)
  *
  * @return void
  */
 public function testBodyEncodingIso2022JpMs()
 {
     $email = new Email(array('charset' => 'iso-2022-jp-ms', 'headerCharset' => 'iso-2022-jp-ms', 'transport' => 'debug'));
     $email->subject('あれ?もしかしての前と');
     $headers = $email->getHeaders(array('subject'));
     $expected = "?ISO-2022-JP?B?GyRCJCIkbCEpJGIkNyQrJDckRiROQTAkSBsoQg==?=";
     $this->assertContains($expected, $headers['Subject']);
     $email->to('someone@example.com')->from('someone@example.com');
     $result = $email->send('①㈱');
     $this->assertTextContains("Content-Type: text/plain; charset=ISO-2022-JP", $result['headers']);
     $this->assertTextNotContains("Content-Type: text/plain; charset=iso-2022-jp-ms", $result['headers']);
     // not charset=iso-2022-jp-ms
     $this->assertContains(mb_convert_encoding('①㈱', 'ISO-2022-JP-MS'), $result['message']);
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:19,代码来源:EmailTest.php

示例5: _prepareMessageHeaders

 /**
  * Prepares the message headers.
  *
  * @param \Cake\Network\Email\Email $email Email instance
  * @return array
  */
 protected function _prepareMessageHeaders($email)
 {
     return $email->getHeaders(['from', 'sender', 'replyTo', 'readReceipt', 'to', 'cc', 'subject', 'returnPath']);
 }
开发者ID:wepbunny,项目名称:cake2,代码行数:10,代码来源:SmtpTransport.php

示例6: _prepareMessageHeaders

 /**
  * Prepares the message headers.
  *
  * @return array
  */
 protected function _prepareMessageHeaders()
 {
     return $this->_cakeEmail->getHeaders(array('from', 'sender', 'replyTo', 'readReceipt', 'to', 'cc', 'subject'));
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:9,代码来源:SmtpTransport.php


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