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


PHP CakeEmail::bcc方法代码示例

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


在下文中一共展示了CakeEmail::bcc方法的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: _prepareData

 /**
  * Prepares the data array.
  * Adds headers and content
  *
  * @return void 
  */
 protected function _prepareData()
 {
     $this->_data = array();
     if (count($this->_cakeEmail->cc()) > 0) {
         throw new CakeException('Postageapp transport does not support cc');
     }
     if (count($this->_cakeEmail->bcc()) > 0) {
         throw new CakeException('Postageapp transport does not support bcc');
     }
     if (count($this->_cakeEmail->sender()) > 0) {
         throw new CakeException('Postageapp transport does not support sender');
     }
     $headers = $this->_cakeEmail->getHeaders(array('from', 'sender', 'replyTo', 'returnPath', 'to', 'subject'));
     $this->_data['recipients'] = $headers['To'];
     $map = array('From', 'Subject', 'Reply-To', 'X-Mailer', 'MIME-Version', 'Content-Transfer-Encoding');
     foreach ($map as $header) {
         if (!empty($headers[$header])) {
             $this->_addHeader($header, $headers[$header]);
         }
     }
     $emailFormat = $this->_cakeEmail->emailFormat();
     if ($emailFormat == 'both' || $emailFormat == 'text') {
         $this->_data['content']['text/plain'] = $this->_cakeEmail->message('text');
     }
     if ($emailFormat == 'both' || $emailFormat == 'html') {
         $this->_data['content']['text/html'] = $this->_cakeEmail->message('html');
     }
 }
开发者ID:jellehenkens,项目名称:CakeEmailTransports,代码行数:34,代码来源:PostageappTransport.php

示例3: 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

示例4: _sendMails

 public function _sendMails($to, $sub = '', $contents = '', $attachments = null, $cc = null, $bcc = null)
 {
     //prd($contents);
     if (empty($from)) {
         $from = strtolower(Configure::read('Site.email'));
     }
     $Email = new CakeEmail();
     $Email->config('smtp');
     $Email->emailFormat('html');
     $Email->subject($sub);
     $Email->template('default', 'default');
     $Email->to($to);
     $Email->from(array($from => $sub));
     $Email->replyTo('mail-noreply@meocart.com', "Meocart Team");
     if (!empty($cc)) {
         $Email->cc($cc);
     }
     if (!empty($bcc)) {
         $Email->bcc($bcc);
     }
     if (!empty($attachments) && $attachments != '' && is_array($attachments)) {
         $Email->attachments($attachments);
     }
     $Email->viewVars(array('content' => $contents));
     try {
         if ($Email->send()) {
             return true;
         }
         return false;
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
开发者ID:dkbakrecha,项目名称:schoolmate,代码行数:33,代码来源:EmailContent.php

示例5: 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

示例6: _prepareRecipientAddresses

 /**
  * Prepares the recipient email addresses.
  *
  * @return array
  */
 protected function _prepareRecipientAddresses()
 {
     $to = $this->_cakeEmail->to();
     $cc = $this->_cakeEmail->cc();
     $bcc = $this->_cakeEmail->bcc();
     return array_merge(array_keys($to), array_keys($cc), array_keys($bcc));
 }
开发者ID:thanphong,项目名称:do-an-tot-nghiep-project,代码行数:12,代码来源:SmtpTransport.php

示例7: 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

示例8: send

 /**
  * Send email via SNS
  * @param CakeEmail $email
  * @return bool
  */
 public function send(CakeEmail $email)
 {
     $ses = SesClient::factory(array("key" => "AKIAIQHPCMQTEEXD5MGA", "secret" => "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", 'region' => 'us-east-1'));
     $destination = array('ToAddresses' => array());
     foreach ($email->to() as $addr => $name) {
         $destination['ToAddresses'][] = "{$name} <{$addr}>";
     }
     foreach ($email->bcc() as $addr => $name) {
         $destination['BccAddresses'][] = "{$name} <{$addr}>";
     }
     $message = array('Subject' => array('Data' => $email->subject()), 'Body' => array());
     $text = $email->message('text');
     if (!empty($text)) {
         $message['Body']['Text'] = array('Data' => $text);
     }
     $html = $email->message('html');
     if (!empty($html)) {
         $message['Body']['Html'] = array('Data' => $html);
     }
     $from = '';
     foreach ($email->from() as $addr => $name) {
         $from = "{$name} <{$addr}>";
         break;
     }
     $response = $ses->sendEmail(['Source' => $from, 'Destination' => $destination, 'Message' => $message]);
     return !empty($response);
 }
开发者ID:kameshwariv,项目名称:testexample,代码行数:32,代码来源:AmazonSESTransport.php

示例9: testPostmarkSend

 /**
  * testPostmarkSend method
  *
  * @return void
  */
 public function testPostmarkSend()
 {
     $this->email->config('postmark');
     $this->email->template('default', 'default');
     $this->email->emailFormat('html');
     $this->email->from(array('yourpostmark@mail.com' => 'Your Name'));
     $this->email->to(array('recipient@domain.com' => 'Recipient'));
     $this->email->cc(array('recipient@domain.com' => 'Recipient'));
     $this->email->bcc(array('recipient@domain.com' => 'Recipient'));
     $this->email->subject('Test Postmark');
     $this->email->addHeaders(array('Tag' => 'my tag'));
     $this->email->attachments(array('cake.icon.png' => array('file' => WWW_ROOT . 'img' . DS . 'cake.icon.png')));
     $sendReturn = $this->email->send();
     $headers = $this->email->getHeaders(array('to'));
     $this->assertEqual($sendReturn['To'], $headers['To']);
     $this->assertEqual($sendReturn['ErrorCode'], 0);
     $this->assertEqual($sendReturn['Message'], 'OK');
 }
开发者ID:julienasp,项目名称:Pilule,代码行数:23,代码来源:PostmarkTransportTest.php

示例10: _sendRcpt

 /**
  * Send emails
  *
  * @return void
  * @throws SocketException
  */
 protected function _sendRcpt()
 {
     $from = $this->_cakeEmail->from();
     $this->_smtpSend('MAIL FROM:<' . key($from) . '>');
     $to = $this->_cakeEmail->to();
     $cc = $this->_cakeEmail->cc();
     $bcc = $this->_cakeEmail->bcc();
     $emails = array_merge(array_keys($to), array_keys($cc), array_keys($bcc));
     foreach ($emails as $email) {
         $this->_smtpSend('RCPT TO:<' . $email . '>');
     }
 }
开发者ID:gilyaev,项目名称:framework-bench,代码行数:18,代码来源:SmtpTransport.php

示例11: main

 public function main()
 {
     $email = new CakeEmail();
     $email->config(array('transport' => 'AmazonSESTransport.AmazonSES', 'log' => true, 'Amazon.SES.Key' => Configure::read('Amazon.SES.Key'), 'Amazon.SES.Secret' => Configure::read('Amazon.SES.Secret')));
     $email->sender('no-reply@example.org');
     $email->from('no-reply@example.org', 'Example');
     $email->to('test@example.org');
     $email->bcc('bcc@example.org');
     $email->subject('SES Test from CakePHP');
     $res = $email->send('test message.');
     var_dump($res);
 }
开发者ID:news2u,项目名称:amazon-ses-transport,代码行数:12,代码来源:SampleCakeEmailShell.php

示例12: _prepareData

 /**
  * Prepares the data array.
  *
  * @return void 
  */
 protected function _prepareData()
 {
     $headers = $this->_cakeEmail->getHeaders(array('from', 'sender', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'subject'));
     if ($headers['Sender'] == '') {
         $headers['Sender'] = $headers['From'];
     }
     $headers = $this->_headersToString($headers);
     $message = implode("\r\n", $this->_cakeEmail->message());
     $this->_data = array('Data' => base64_encode($headers . "\r\n\r\n" . $message . "\r\n\r\n\r\n."));
     $this->_dataOptions = array('Source' => key($this->_cakeEmail->from()), 'Destinations' => array());
     $this->_dataOptions['Destinations'] += array_keys($this->_cakeEmail->to());
     $this->_dataOptions['Destinations'] += array_keys($this->_cakeEmail->cc());
     $this->_dataOptions['Destinations'] += array_keys($this->_cakeEmail->bcc());
     $this->_content = array('headers' => $headers, 'message' => $message);
 }
开发者ID:jellehenkens,项目名称:CakeEmailTransports,代码行数:20,代码来源:AmazonTransport.php

示例13: send

 /**
  * Send
  * 
  * A bit of a misnomer, because this actually just adds it to a CakeResque
  * queue.  The actual sending of the email will be performed later by a worker.
  *
  * @params CakeEmail $email
  * @return array
  */
 public function send(CakeEmail $email)
 {
     // Take a copy of the existing configuration.
     $config = array('headers' => $email->getHeaders(), 'from' => $email->from(), 'sender' => $email->sender(), 'replyTo' => $email->replyTo(), 'readReceipt' => $email->readReceipt(), 'returnPath' => $email->returnPath(), 'to' => $email->to(), 'cc' => $email->cc(), 'bcc' => $email->bcc(), 'subject' => $email->subject(), 'viewRender' => $email->viewRender(), 'viewVars' => $email->viewVars(), 'emailFormat' => $email->emailFormat(), 'messageId' => $email->messageId(), 'attachments' => $email->attachments());
     //        unset($config['config']['transport']);
     $template = $email->template();
     $config['template'] = $template['template'];
     $config['layout'] = $template['layout'];
     // Clean it up to avoid errors.
     $config = array_filter($config, function ($v) {
         return (bool) $v;
     });
     debug($config);
     // Include a message, if they sent one via plain text.
     $message = $email->message(CakeEmail::MESSAGE_HTML) ? null : $email->message(CakeEmail::MESSAGE_TEXT);
     // Drop it in a queue.
     Resque::enqueue('email', 'ResqueEmail.EmailShell', array('send', $config, $message));
     return array('headers' => $email->getHeaders(), 'message' => $email->message());
 }
开发者ID:adderall,项目名称:cake-resque-email,代码行数:28,代码来源:QueuedTransport.php

示例14: broadcast

 public function broadcast()
 {
     if ($this->request->is('post')) {
         $gmail = new CakeEmail('gmail');
         $emails = Hash::extract($this->EventMembership->find('all', array('conditions' => array('event_id' => $this->request->data['eventid']))), "{n}.User.email");
         $gmail->bcc(array_filter($emails));
         $gmail->subject($this->request->data['subject']);
         $messages = $gmail->send($this->request->data['messages']);
         if ($messages == null) {
             $this->Session->setFlash("メールが送信できませんでした。管理者にお問い合わせください。", "flash_error");
         } else {
             $this->Session->setFlash("メール送信が完了しました。", "flash_success");
         }
         $this->redirect(array('controller' => 'Event', 'action' => 'detail', $this->request->data['eventid']));
     } else {
         $event = $this->Event->findById($this->passedArgs[0]);
         if ($event['Event']['owner'] != $this->Auth->user('id')) {
             throw new NotFoundException();
         }
         $this->set('eventid', $this->passedArgs[0]);
         $this->set('subject', "【seapa】" . $event['Event']['title'] . "からのお知らせ");
     }
 }
开发者ID:saramune,项目名称:seapa,代码行数:23,代码来源:CoordinatorController.php

示例15: buildRequest

 protected function buildRequest(CakeEmail $email)
 {
     $sender = $email->from();
     if (key($sender) != 'mailerloop@mailerloop.com') {
         $this->data['fromEmail'] = key($sender);
         $this->data['fromName'] = reset($sender);
     }
     $replyTo = $email->replyTo();
     if (!empty($replyTo)) {
         $this->data['replyToEmail'] = key($replyTo);
         $this->data['replyToName'] = reset($replyTo);
     }
     $headers = $email->getHeaders(array('subject', 'id', 'language'));
     if (empty($headers['id'])) {
         throw new CakeException("ID header is required");
     }
     $this->data['templateId'] = $headers['id'];
     if (!empty($headers['language'])) {
         $this->data['language'] = $headers['language'];
     }
     $variables = $email->viewVars();
     $variables['subject'] = $headers['Subject'];
     $recipients = array_merge($email->to(), $email->cc(), $email->bcc());
     if (count($recipients) > 1) {
         $this->data['batch'] = array();
         foreach ($recipients as $recipientEmail => $recipientName) {
             $this->data['batch'][] = array('variables' => $variables, 'templateId' => $headers['id'], 'recipientName' => $recipientName, 'recipientEmail' => $recipientEmail);
         }
     } else {
         $this->data['recipientName'] = reset($recipients);
         $this->data['recipientEmail'] = key($recipients);
         $this->data['variables'] = $variables;
     }
     $this->addAttachments($email);
     return $this->data;
 }
开发者ID:kimbalt,项目名称:mailerloop,代码行数:36,代码来源:MailerLoopTransport.php


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