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