本文整理汇总了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;
}
}
示例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;
}
}
示例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);
}
示例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']);
}
示例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']);
}
示例6: _prepareMessageHeaders
/**
* Prepares the message headers.
*
* @return array
*/
protected function _prepareMessageHeaders()
{
return $this->_cakeEmail->getHeaders(array('from', 'sender', 'replyTo', 'readReceipt', 'to', 'cc', 'subject'));
}