コード例 #1
0
 /**
  * 
  * @author Anand Thakkar <*****@*****.**>
  * @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
0
 /**
  * 
  * @author Anand Thakkar <*****@*****.**>
  * @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
0
ファイル: MailTransport.php プロジェクト: maitrepylos/nazeweb
 /**
  * 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
0
ファイル: EmailTest.php プロジェクト: maitrepylos/nazeweb
 /**
  * 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('*****@*****.**')->from('*****@*****.**');
     $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
0
ファイル: SmtpTransport.php プロジェクト: wepbunny/cake2
 /**
  * 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
0
 /**
  * Prepares the message headers.
  *
  * @return array
  */
 protected function _prepareMessageHeaders()
 {
     return $this->_cakeEmail->getHeaders(array('from', 'sender', 'replyTo', 'readReceipt', 'to', 'cc', 'subject'));
 }