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


PHP CakeEmail::config方法代码示例

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


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

示例1: send

 /**
  * Sends out email via Mandrill
  *
  * @param CakeEmail $email
  * @return array
  */
 public function send(CakeEmail $email)
 {
     // CakeEmail
     $this->_cakeEmail = $email;
     $from = $this->_cakeEmail->from();
     list($fromEmail) = array_keys($from);
     $fromName = $from[$fromEmail];
     $this->_config = $this->_cakeEmail->config();
     $this->_headers = $this->_cakeEmail->getHeaders();
     $message = array('html' => $this->_cakeEmail->message('html'), 'text' => $this->_cakeEmail->message('text'), 'subject' => mb_decode_mimeheader($this->_cakeEmail->subject()), 'from_email' => $fromEmail, 'from_name' => $fromName, 'to' => array(), 'headers' => array('Reply-To' => $fromEmail), 'important' => false, 'track_opens' => null, 'track_clicks' => null, 'auto_text' => null, 'auto_html' => null, 'inline_css' => null, 'url_strip_qs' => null, 'preserve_recipients' => null, 'view_content_link' => null, 'tracking_domain' => null, 'signing_domain' => null, 'return_path_domain' => null, 'merge' => true, 'tags' => null, 'subaccount' => null);
     $message = array_merge($message, $this->_headers);
     foreach ($this->_cakeEmail->to() as $email => $name) {
         $message['to'][] = array('email' => $email, 'name' => $name, 'type' => 'to');
     }
     foreach ($this->_cakeEmail->cc() as $email => $name) {
         $message['to'][] = array('email' => $email, 'name' => $name, 'type' => 'cc');
     }
     foreach ($this->_cakeEmail->bcc() as $email => $name) {
         $message['to'][] = array('email' => $email, 'name' => $name, 'type' => 'bcc');
     }
     $attachments = $this->_cakeEmail->attachments();
     if (!empty($attachments)) {
         $message['attachments'] = array();
         foreach ($attachments as $file => $data) {
             $message['attachments'][] = array('type' => $data['mimetype'], 'name' => $file, 'content' => base64_encode(file_get_contents($data['file'])));
         }
     }
     $params = array('message' => $message, "async" => false, "ip_pool" => null, "send_at" => null);
     return $this->_exec($params);
 }
开发者ID:surjit,项目名称:Mandrill-CakePHP-plugin,代码行数:36,代码来源:MandrillTransport.php

示例2: send

 /**
  * Sends out email via Mandrill
  *
  * @return array Return the Mandrill
  */
 public function send(CakeEmail $email)
 {
     // CakeEmail
     $this->_cakeEmail = $email;
     $this->_config = $this->_cakeEmail->config();
     $this->_headers = $this->_cakeEmail->getHeaders(array('from', 'to', 'cc', 'bcc', 'replyTo', 'subject'));
     // Setup connection
     $this->__mandrillConnection =& new HttpSocket();
     // Build message
     $message = $this->__buildMessage();
     // Build request
     $request = $this->__buildRequest();
     if (isset($this->_config['mandrillTemplate']) && !empty($this->_config['mandrillTemplate'])) {
         $message_send_uri = $this->_config['uri'] . "messages/send-template.json";
     } else {
         $message_send_uri = $this->_config['uri'] . "messages/send.json";
     }
     // Send message
     try {
         $returnMandrill = $this->__mandrillConnection->post($message_send_uri, json_encode($message), $request);
         // Return data
         $result = json_decode($returnMandrill, true);
         $headers = $this->_headersToString($this->_headers);
         return array_merge(array('Mandrill' => $result), array('headers' => $headers, 'message' => $message));
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:zooteradmin,项目名称:interview,代码行数:33,代码来源:MandrillTransport.php

示例3: send

 /**
  * Sends out email via Mandrill
  *
  * @return array Return the Mandrill
  */
 public function send(CakeEmail $email)
 {
     $this->_Email = $email;
     $this->_config = $this->_Email->config() + (array) Configure::read('Mandrill');
     if (empty($this->_config['apiKey'])) {
         throw new InternalErrorException('No API key');
     }
     if (empty($this->_config['uri'])) {
         $this->_config['uri'] = static::API_URL;
     }
     $include = ['from', 'to', 'cc', 'bcc', 'replyTo', 'subject'];
     $this->_headers = $this->_Email->getHeaders($include);
     $message = $this->_buildMessage();
     $request = ['header' => ['Accept' => 'application/json', 'Content-Type' => 'application/json']];
     $template = $this->_Email->template();
     if ($template['template'] && !empty($this->_config['useTemplate'])) {
         $messageUri = $this->_config['uri'] . "messages/send-template.json";
     } else {
         $messageUri = $this->_config['uri'] . "messages/send.json";
     }
     // Perform the http connection
     $returnMandrill = $this->_post($messageUri, $message, $request);
     // Parse mandrill results
     $result = json_decode($returnMandrill, true);
     if (!empty($this->_config['log'])) {
         CakeLog::write('mandrill', print_r($result, true));
     }
     $headers = $this->_headersToString($this->_headers);
     return array_merge(['Mandrill' => $result], ['headers' => $headers, 'message' => $message]);
 }
开发者ID:drmonkeyninja,项目名称:cakephp-mailchimp,代码行数:35,代码来源:MandrillTransport.php

示例4: email

 public static function email($data)
 {
     try {
         $email = new CakeEmail();
         $email->config(!empty($data['settings']) ? $data['settings'] : 'default');
         $email->config($data)->send();
     } catch (Exception $e) {
         return json_encode($email) . ' ' . $e->getMessage();
     }
     return true;
 }
开发者ID:inigoflores,项目名称:CakePHP-Notification-Manager,代码行数:11,代码来源:NotificationUtility.php

示例5: send

 /**
  * Sends out email via SparkPost
  *
  * @param CakeEmail $email
  * @return array
  */
 public function send(CakeEmail $email)
 {
     // CakeEmail
     $this->_cakeEmail = $email;
     $this->_config = $this->_cakeEmail->config();
     $this->_headers = $this->_cakeEmail->getHeaders();
     // Not allowed by SparkPost
     unset($this->_headers['Content-Type']);
     unset($this->_headers['Content-Transfer-Encoding']);
     unset($this->_headers['MIME-Version']);
     unset($this->_headers['X-Mailer']);
     $from = $this->_cakeEmail->from();
     list($fromEmail) = array_keys($from);
     $fromName = $from[$fromEmail];
     $message = ['html' => $this->_cakeEmail->message('html'), 'text' => $this->_cakeEmail->message('text'), 'from' => ['name' => $fromName, 'email' => $fromEmail], 'subject' => mb_decode_mimeheader($this->_cakeEmail->subject()), 'recipients' => [], 'transactional' => true];
     foreach ($this->_cakeEmail->to() as $email => $name) {
         $message['recipients'][] = ['address' => ['email' => $email, 'name' => $name], 'tags' => $this->_headers['tags']];
     }
     foreach ($this->_cakeEmail->cc() as $email => $name) {
         $message['recipients'][] = ['address' => ['email' => $email, 'name' => $name], 'tags' => $this->_headers['tags']];
     }
     foreach ($this->_cakeEmail->bcc() as $email => $name) {
         $message['recipients'][] = ['address' => ['email' => $email, 'name' => $name], 'tags' => $this->_headers['tags']];
     }
     unset($this->_headers['tags']);
     $attachments = $this->_cakeEmail->attachments();
     if (!empty($attachments)) {
         $message['attachments'] = array();
         foreach ($attachments as $file => $data) {
             if (!empty($data['contentId'])) {
                 $message['inlineImages'][] = array('type' => $data['mimetype'], 'name' => $data['contentId'], 'data' => base64_encode(file_get_contents($data['file'])));
             } else {
                 $message['attachments'][] = array('type' => $data['mimetype'], 'name' => $file, 'data' => base64_encode(file_get_contents($data['file'])));
             }
         }
     }
     $message = array_merge($message, $this->_headers);
     // Load SparkPost configuration settings
     $config = ['key' => $this->_config['sparkpost']['api_key']];
     if (isset($this->_config['sparkpost']['timeout'])) {
         $config['timeout'] = $this->_config['sparkpost']['timeout'];
     }
     // Set up HTTP request adapter
     $httpAdapter = new Ivory\HttpAdapter\Guzzle6HttpAdapter($this->__getClient());
     // Create SparkPost API accessor
     $sparkpost = new SparkPost\SparkPost($httpAdapter, $config);
     // Send message
     try {
         return $sparkpost->transmission->send($message);
     } catch (SparkPost\APIResponseException $e) {
         // TODO: Determine if BRE is the best exception type
         throw new BadRequestException(sprintf('SparkPost API error %d (%d): %s (%s)', $e->getAPICode(), $e->getCode(), ucfirst($e->getAPIMessage()), $e->getAPIDescription()));
     }
 }
开发者ID:wvdongen,项目名称:cakephp-sparkpost,代码行数:60,代码来源:SparkPostTransport.php

示例6: send

 public function send()
 {
     $config = $this->args[0];
     $message = $this->args[1];
     $email = new CakeEmail('resqueEmail');
     CakeLog::write(LOG_DEBUG, print_r($email->config(), true));
     CakeLog::write(LOG_DEBUG, print_r($config, true));
     $email->config($config);
     CakeLog::write(LOG_DEBUG, print_r($email->config(), true));
     $email->send($message);
 }
开发者ID:adderall,项目名称:cake-resque-email,代码行数:11,代码来源:EmailShell.php

示例7: send

 /**
  * Sends out email via SendGrid
  *
  * @return bool
  */
 public function send(CakeEmail $email)
 {
     // CakeEmail
     $this->_cakeEmail = $email;
     $this->_config = $this->_cakeEmail->config();
     if (empty($this->_config['count']) || $this->_config['count'] > 500) {
         $this->_config['count'] = 500;
     }
     $this->_headers = $this->_cakeEmail->getHeaders();
     $this->_recipients = $email->to();
     $this->_replyTo = $email->replyTo();
     return $this->_sendPart();
 }
开发者ID:rogerbenevento,项目名称:sendgrid-webapi-cakephp-plugin,代码行数:18,代码来源:SendgridTransport.php

示例8: sendEmail

 public function sendEmail($to, $subject, $template = 'default', $content = null, $viewVars = [], $options = [])
 {
     $defaults = ['emailFormat' => 'html'];
     $options = array_merge($defaults, $options);
     $email = new CakeEmail();
     $email->config('smtp');
     $email->config(['from' => ['info@hurad.org' => Configure::read('General.site_name')]]);
     $email->to($to);
     $email->setHeaders(['X-Mailer' => "Hurad Mail"]);
     $email->emailFormat($options['emailFormat']);
     $email->template($template);
     $email->viewVars($viewVars);
     $email->subject($subject);
     $email->send($content);
 }
开发者ID:hurad,项目名称:hurad,代码行数:15,代码来源:HuradComponent.php

示例9: main

 public function main()
 {
     define('TIMEZONE', 'Asia/Bangkok');
     date_default_timezone_set(TIMEZONE);
     $now = date("Y-m-d H:i:s");
     $tomorrow = date("Y-m-d H:i:s", time() + EVENT_REMIDER_TIMER);
     $optionCalendar = array('order' => array('from_date' => 'asc'), 'conditions' => array('from_date >=' => $now, 'to_date <=' => $tomorrow));
     $events = $this->Calendar->find("all", $optionCalendar);
     foreach ($events as $key => $event) {
         $content = array();
         $content["id"] = $event["Calendar"]["id"];
         $content["name"] = $event["Calendar"]["name"];
         $content["description"] = $event["Calendar"]["description"];
         $content["from_date"] = $this->_formatDate($events[$key]["Calendar"]["from_date"], "d-m-Y H:i");
         $content["to_date"] = $this->_formatDate($events[$key]["Calendar"]["to_date"], "d-m-Y H:i");
         $id = $event["Calendar"]["id"];
         $user = $this->UserModel->findById($event["Calendar"]["user_id"]);
         $content["receive_name"] = $user["UserModel"]["display_name"];
         $Email = new CakeEmail('noreply');
         $noreplyConf = $Email->config();
         $Email->template('calendar_remider');
         $Email->emailFormat('html');
         $Email->viewVars(array('emailContent' => $content));
         $Email->from($noreplyConf['from']);
         $Email->to($user["UserModel"]["user_email"]);
         $Email->subject(__('Calendar Reminder'));
         $Email->send();
     }
     //echo EVENT_REMIDER_TIMER;
 }
开发者ID:pdkhuong,项目名称:BBG,代码行数:30,代码来源:CalendarMailShell.php

示例10: index

 public function index()
 {
     if (!empty($this->data)) {
         if ($this->request->is('post')) {
             $data = $this->request->data;
             if ($this->Matriculation->save($data)) {
                 $email = new CakeEmail();
                 $email->config('default');
                 $email->from(array('contato@sardonixidiomas.com' => 'Sardonix Idiomas | Automático'));
                 $email->to('contato@sardonixidiomas.com');
                 $email->subject("Matrícula - {$data['Matriculation']['name']} ");
                 $cursos = '';
                 if (isset($data['Matriculation']['english'])) {
                     $cursos .= 'Inglês; ';
                 }
                 if (isset($data['Matriculation']['italian'])) {
                     $cursos .= 'Italiano; ';
                 }
                 if (isset($data['Matriculation']['portuguese'])) {
                     $cursos .= 'Português; ';
                 }
                 $date = new DateTime();
                 $message = "Nome: {$data['Matriculation']['name']}\n\n";
                 $message .= "Telefone: {$data['Matriculation']['phone']}\n\n";
                 $message .= "Celular: {$data['Matriculation']['cellphone']}\n\n";
                 $message .= "Idiomas de interesse: {$cursos}\n\n";
                 $message .= "E-mail: {$data['Matriculation']['email']} \n\n";
                 $message .= "Soube: {$data['Matriculation']['where']}\n\n";
                 $message .= "Acessou em: " . $date->format('d/m/Y H:i:s');
                 $email->send($message);
                 $this->render('enviado');
             }
         }
     }
 }
开发者ID:davigbr,项目名称:sardonix-website,代码行数:35,代码来源:MatriculaController.php

示例11: handleException

 public function handleException(Exception $exception, $shutdown = false)
 {
     $this->_exception = $exception;
     $email = new CakeEmail('error');
     $prefix = Configure::read('ExceptionNotifier.prefix');
     $from = $email->from();
     if (empty($from)) {
         $email->from('exception.notifier@default.com', 'Exception Notifier');
     }
     $subject = $email->subject();
     if (empty($subject)) {
         $email->subject($prefix . '[' . date('Ymd H:i:s') . '][' . $this->_getSeverityAsString() . '][' . ExceptionText::getUrl() . '] ' . $exception->getMessage());
     }
     if ($this->useSmtp) {
         $email->transport('Smtp');
         $email->config($this->smtpParams);
     }
     $text = ExceptionText::getText($exception->getMessage(), $exception->getFile(), $exception->getLine());
     $email->send($text);
     // return Exception.handler
     if ($shutdown || !$this->_exception instanceof ErrorException) {
         $config = Configure::read('Exception');
         $handler = $config['handler'];
         if (is_string($handler)) {
             call_user_func($handler, $exception);
         } elseif (is_array($handler)) {
             call_user_func_array($handler, $exception);
         }
     }
 }
开发者ID:k1low,项目名称:exception,代码行数:30,代码来源:ExceptionNotifierComponent.php

示例12: individualMail

 public function individualMail($section, $arr = array())
 {
     $this->autoRender = false;
     $contents = $this->Mail->findBySection($section);
     $content = $contents['Mail']['content'];
     foreach ($arr as $key => $val) {
         $content = str_replace("~~{$key}~~", $val, $content);
     }
     if (!empty($arr['TO_EMAIL']) && Validation::email($arr['TO_EMAIL'], true)) {
         $email = new CakeEmail();
         $email->template('default');
         $email->config('default');
         $email->emailFormat('html')->to($arr['TO_EMAIL'])->subject($contents['Mail']['subject']);
         try {
             if ($email->send($content)) {
                 return;
             } else {
                 return;
             }
         } catch (Exception $e) {
             return;
         }
     }
     return;
 }
开发者ID:pushpendraraj,项目名称:tigzie,代码行数:25,代码来源:MailController.php

示例13: process

 public function process()
 {
     $c = new CakeEmail('default');
     //grab 50 emails
     $emails = $this->EmailMessage->find("all", array("conditions" => array("EmailMessage.processed" => 0, "EmailMessage.to !=" => '', "NOT" => array("EmailMessage.to" => null)), "contain" => array()));
     $total_emails = count($emails);
     $this->out("emails to processes: " . $total_emails);
     SysMsg::add(array("category" => "Emailer", "from" => "MailerShell", "crontab" => 1, "title" => "Emails to processes: " . $total_emails));
     foreach ($emails as $email) {
         $e = $email['EmailMessage'];
         $c->reset();
         $c->config('default');
         $c->to($e['to']);
         $c->subject($e['subject']);
         $c->template($e['template']);
         $c->viewVars(array("msg" => $email));
         if ($c->send()) {
             $this->EmailMessage->create();
             $this->EmailMessage->id = $e['id'];
             $this->EmailMessage->save(array("processed" => 1, "sent_date" => DboSource::expression('NOW()')));
             $total_emails--;
             $this->out("Email:" . $e['to'] . " Template: " . $e['template']);
         } else {
             $this->out("Email failed: " . $e['id']);
             SysMsg::add(array("category" => "Emailer", "from" => "MailerShell", "crontab" => 1, "title" => "Email Failed: " . $e['id']));
         }
     }
 }
开发者ID:josephbergdoll,项目名称:berrics,代码行数:28,代码来源:MailerShell.php

示例14: sendEmail

 public function sendEmail($to = NULL, $subject = NULL, $data = NULL, $template = NULL, $format = 'text', $cc = NULL, $bcc = NULL)
 {
     $Email = new CakeEmail();
     $Email->from(array(Configure::read('Email_From_Email') => Configure::read('Email_From_Name')));
     //$Email->config(Configure::read('TRANSPORT'));
     $Email->config('default');
     $Email->template($template);
     if ($to != NULL) {
         $Email->to($to);
     }
     if ($cc != NULL) {
         $Email->cc($cc);
     }
     if ($bcc != NULL) {
         $Email->bcc($bcc);
     }
     $Email->subject($subject);
     $Email->viewVars($data);
     $Email->emailFormat($format);
     if ($Email->send()) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:yogesha3,项目名称:yogesh-test,代码行数:25,代码来源:Email.php

示例15: index

 /**
  * Wenn es sich um einen POST-Request handelt, wird eine Rundmail mit den übergebenen Daten versendet.
  * 
  * @author aloeser
  * @return void
  */
 public function index()
 {
     if ($this->request->is('POST')) {
         $conditions = array('User.mail !=' => '', 'User.admin != ' => 2);
         if (!$this->request->data['Mail']['sendToAll']) {
             $conditions['User.leave_date'] = null;
         }
         $activeUsersWithEmail = $this->User->find('all', array('conditions' => $conditions));
         $receivers = array();
         foreach ($activeUsersWithEmail as $user) {
             array_push($receivers, $user['User']['mail']);
         }
         $senderMail = 'humboldt-cafeteria@versanet.de';
         $senderName = 'Humboldt Cafeteria';
         $EMail = new CakeEmail();
         $EMail->from(array($senderMail => $senderName));
         $EMail->bcc($receivers);
         $EMail->subject($this->request->data['Mail']['subject']);
         $EMail->config('web');
         $EMail->template('default');
         $EMail->emailFormat('html');
         $EMail->viewVars(array('senderName' => $senderName, 'senderMail' => $senderMail, 'content' => $this->request->data['Mail']['content'], 'subject' => $this->request->data['Mail']['subject'], 'allowReply' => $this->request->data['Mail']['allowReply']));
         if ($EMail->send()) {
             $this->Session->setFlash('Die Rundmail wurde erfolgreich abgeschickt.', 'alert-box', array('class' => 'alert-success'));
             $this->redirect(array('action' => 'index'));
         } else {
             $this->Session->setFlash('Beim Senden ist ein Fehler aufgetreten.', 'alert-box', array('class' => 'alert-error'));
         }
     }
     $this->set('actions', array());
 }
开发者ID:jgraeger,项目名称:cafeplaner,代码行数:37,代码来源:MailController.php


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