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


PHP Email::from方法代码示例

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


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

示例1: send

 /**
  * Send mail using Mandrill (by MailChimp)
  *
  * @param \Cake\Network\Email\Email $email Cake Email
  * @return array
  */
 public function send(Email $email)
 {
     $this->transportConfig = Hash::merge($this->transportConfig, $this->_config);
     // Initiate a new Mandrill Message parameter array
     $message = ['html' => $email->message(\Cake\Network\Email\Email::MESSAGE_HTML), 'text' => $email->message(\Cake\Network\Email\Email::MESSAGE_TEXT), 'subject' => $this->_decode($email->subject()), 'from_email' => key($email->from()), 'from_name' => current($email->from()), 'to' => [], 'headers' => ['Reply-To' => is_null(key($email->replyTo())) ? key($email->from()) : key($email->replyTo())], 'recipient_metadata' => [], 'attachments' => [], 'images' => []];
     // Merge Mandrill Parameters
     $message = array_merge($message, Hash::merge($this->defaultParameters, $email->profile()['Mandrill']));
     // Add receipients
     foreach (['to', 'cc', 'bcc'] as $type) {
         foreach ($email->{$type}() as $mail => $name) {
             $message['to'][] = ['email' => $mail, 'name' => $name, 'type' => $type];
         }
     }
     // Attachments
     $message = $this->_attachments($email, $message);
     // Create a new scoped Http Client
     $this->http = new Client(['host' => 'mandrillapp.com', 'scheme' => 'https', 'headers' => ['User-Agent' => 'CakePHP Mandrill Plugin']]);
     // Sending as a template? Then in case we find mail content, we add this as a 'template_content'.
     // In you Mandrill template, use <div mc:edit="content"></div> to get the contents of your email
     if (!is_null($message['template_name']) && $message['html']) {
         if (!isset($message['template_content']) || !is_array($message['template_content'])) {
             $message['template_content'] = [];
         }
         $message['template_content'][] = ['name' => 'content', 'content' => $message['html']];
     }
     // Are we sending a template?
     if (!is_null($message['template_name']) && !empty($message['template_content'])) {
         return $this->_sendTemplate($message, $this->transportConfig['async'], $this->transportConfig['ip_pool'], $message['send_at']);
     } else {
         return $this->_send($message, $this->transportConfig['async'], $this->transportConfig['ip_pool'], $message['send_at']);
     }
 }
开发者ID:lennaert,项目名称:cakephp3-mandrill,代码行数:38,代码来源:MandrillTransport.php

示例2: emailToManager

 public function emailToManager()
 {
     //$this->out('Hello Manager');
     $email = new Email('default');
     $email->from(['admin@dimanamacet.com' => 'Administrator dimanamacet.com'])->to('aansubarkah@gmail.com')->subject('Daily Activity')->send('Lorem Ipsum DOlor sit Amet');
     $this->out('Success');
 }
开发者ID:aansubarkah,项目名称:apimiminmacetdimana,代码行数:7,代码来源:ReportShell.php

示例3: _prepareFromAddress

 /**
  * Prepares the `from` email address.
  *
  * @return array
  */
 protected function _prepareFromAddress()
 {
     $from = $this->_cakeEmail->returnPath();
     if (empty($from)) {
         $from = $this->_cakeEmail->from();
     }
     return $from;
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:13,代码来源:SmtpTransport.php

示例4: afterForgot

 public function afterForgot($event, $user)
 {
     $email = new Email('default');
     $email->viewVars(['user' => $user, 'resetUrl' => Router::fullBaseUrl() . Router::url(['prefix' => false, 'plugin' => 'Users', 'controller' => 'Users', 'action' => 'reset', $user['email'], $user['request_key']]), 'baseUrl' => Router::fullBaseUrl(), 'loginUrl' => Router::fullBaseUrl() . '/login']);
     $email->from(Configure::read('Users.email.from'));
     $email->subject(Configure::read('Users.email.afterForgot.subject'));
     $email->emailFormat('both');
     $email->transport(Configure::read('Users.email.transport'));
     $email->template('Users.afterForgot', 'Users.default');
     $email->to($user['email']);
     $email->send();
 }
开发者ID:hareshpatel1990,项目名称:cakephp-users,代码行数:12,代码来源:UsersMailer.php

示例5: _execute

 protected function _execute(array $data)
 {
     $email = new Email('default');
     $email->template("devis");
     $email->emailFormat("both");
     $email->viewVars($data);
     $email->from(["contact@renopatrimoine.fr" => "Contact Reno Patrimoine"]);
     $email->to("panini.zozo@gmail.com");
     $email->subject("Demande de devis: " . $data["prenom"] . " " . $data["nom"]);
     $email->send();
     return true;
 }
开发者ID:JulienPapini,项目名称:RenoPatrimoine,代码行数:12,代码来源:DevisForm.php

示例6: dadosAtualizados

 public function dadosAtualizados()
 {
     $users = $ldap->getUsers("uid=*");
     $emails = array();
     foreach ($users as $user) {
         $email = $user['uid'][0] . '@smt.ufrj.br';
         array_push($emails, $email);
     }
     $email = new Email('gmail');
     $email->from(['netadmin@smt.ufrj.br' => 'Controle de Usuarios'])->emailFormat('html')->to($emails)->subject('Notificação SMT')->send('Favor manter seus dados atualizados.');
     $aviso = new Email('gmail');
     $aviso->from(['netadmin@smt.ufrj.br' => 'Controle de Usuarios'])->emailFormat('html')->to('suporte.intranetsmt@gmail.com')->subject('JOB Realizado')->send('Job Dados Atualizados executado com sucesso.');
 }
开发者ID:gbauso,项目名称:asirb,代码行数:13,代码来源:NotificacaoController.php

示例7: _execute

 protected function _execute(array $data)
 {
     //print_r($data); exit;
     if (null != $data['email']) {
         $adminEmail = "contact@marketingconnex.com";
         //EMAIL THE Admin
         $subject = __('A new form submission been received from the MarketingConneX.com Challenges landing page');
         $email = new Email('default');
         $email->sender($data['email'], $data['firstname']);
         $email->from([$data['email'] => $data['firstname']])->to([$adminEmail => 'marketingconneX.com'])->subject($subject)->emailFormat('html')->template('landingpageform')->viewVars(array('firstname' => $data['firstname'], 'lastname' => $data['lastname'], 'email' => $data['email'], 'website' => $data['website'], 'phone' => $data['phone'], 'info' => $data['info'], 'landingpage' => $data['landingpage']))->send();
         return true;
     }
     return false;
 }
开发者ID:franky0930,项目名称:MarketingConnex,代码行数:14,代码来源:LandingPageForm.php

示例8: _execute

 protected function _execute(array $data)
 {
     //print_r($data); exit;
     if (null != $data['email']) {
         //SEND TO SALES FORCE
         //-----------------------------------
         //then bundle the request and send it to Salesforce.com
         $req = "&lead_source=" . "Web";
         $req .= "&first_name=" . $data['firstname'];
         $req .= "&last_name=" . $data['lastname'];
         $req .= "&company=" . $data['company'];
         $req .= "&00N20000009ZAQB=" . $data['position'];
         $req .= "&email=" . $data['email'];
         $req .= "&phone=" . $data['phone'];
         $req .= "&debug=" . urlencode("0");
         $req .= "&oid=" . urlencode("00D20000000ozqG");
         $req .= "&retURL=" . urlencode("http://qa.marketingconnex.com/pages/thank-you");
         $req .= "&debugEmail=" . urlencode("dom@huxleydigital.co.uk");
         $header = "POST /servlet/servlet.WebToLead?encoding=UTF-8 HTTP/1.0\r\n";
         $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
         $header .= "Host: www.salesforce.com\r\n";
         $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
         $fp = fsockopen('www.salesforce.com', 80, $errno, $errstr, 30);
         if (!$fp) {
             echo "No connection made";
         } else {
             fputs($fp, $header . $req);
             while (!feof($fp)) {
                 $res = fgets($fp, 1024);
                 //echo $res;
             }
         }
         fclose($fp);
         //-----------------------------------
         $adminEmail = "contact@marketingconnex.com";
         //EMAIL THE CUSTOMER
         $subject = __('Thank you for contacting MarketingConneX.com');
         $email = new Email('default');
         $email->sender($adminEmail, 'marketingconneX.com');
         $email->from([$adminEmail => 'marketingconneX.com'])->to([$data['email'] => $data['name']])->subject($subject)->emailFormat('html')->template('contactform', 'system')->viewVars(array('email_type' => 'customer', 'name' => $data['firstname'], 'company' => $data['company'], 'position' => $data['position'], 'email' => $data['email'], 'site_url' => 'http://www.marketingconnex.com', 'SITE_NAME' => 'MarketingConneX.com', 'phone' => $data['phone'], 'info' => $data['info'], 'message' => $data['message']))->send();
         //EMAIL THE Admin
         $subject = __('A new enquiry has been received on MarketingConneX.com');
         $email = new Email('default');
         $email->sender($adminEmail, 'marketingconneX.com');
         $email->from([$data['email'] => $data['name']])->to([$adminEmail => 'marketingconneX.com'])->subject($subject)->emailFormat('html')->template('contactform', 'system')->viewVars(array('email_type' => 'admin', 'name' => $data['firstname'], 'company' => $data['company'], 'position' => $data['position'], 'email' => $data['email'], 'site_url' => 'http://www.marketingconnex.com', 'SITE_NAME' => 'MarketingConneX.com', 'phone' => $data['phone'], 'info' => $data['info'], 'message' => $data['message']))->send();
         return true;
     }
     return false;
 }
开发者ID:franky0930,项目名称:MarketingConnex,代码行数:49,代码来源:ContactForm.php

示例9: email

 public function email()
 {
     if ($this->request->is('get')) {
         $userId = $this->Auth->user('id');
         $username = $this->Auth->user('username');
         $this->loadModel('UserTypes');
         $userTypes = $this->UserTypes->listSubCategories();
         $this->set(compact('userId', 'username', 'userTypes'));
     } else {
         if ($this->request->is('post')) {
             Email::configTransport('gmail', ['host' => 'smtp.gmail.com', 'port' => 587, 'username' => 'ricardohenrique996@gmail.com', 'password' => 'mustang996', 'className' => 'Smtp', 'tls' => true]);
             $email = new Email();
             $email->transport('gmail');
             $email->from(['ricardohenrique996@gmail.com' => 'Store Site'])->to('ricardohenrique1@outlook.com')->emailFormat('html')->subject(FormatContactForm::getSubject($this->request->data['subject'], ['suffix' => ' | Store Site']))->send(FormatContactForm::getMessage($this->request->data, ['uppercaseLabel' => true]));
             return $this->redirect(['controller' => 'CustomStaticPages', 'action' => 'index']);
         }
     }
 }
开发者ID:ricardohenriq,项目名称:shooping,代码行数:18,代码来源:CustomStaticPagesController.php

示例10: testSendWithEmail

 /**
  * TestSend method
  *
  * @return void
  */
 public function testSendWithEmail()
 {
     $Email = new Email();
     $Email->from('noreply@cakephp.org', 'CakePHP Test');
     $Email->to('cake@cakephp.org', 'CakePHP');
     $Email->cc(['mark@cakephp.org' => 'Mark Story', 'juan@cakephp.org' => 'Juan Basso']);
     $Email->bcc('phpnut@cakephp.org');
     $Email->subject('Testing Message');
     $Email->transport('queue');
     $config = $Email->config('default');
     $this->QueueTransport->config($config);
     $result = $this->QueueTransport->send($Email);
     $this->assertEquals('Email', $result['jobtype']);
     $this->assertTrue(strlen($result['data']) < 10000);
     $output = unserialize($result['data']);
     //debug($output);
     //$this->assertEquals($Email, $output['settings']);
 }
开发者ID:repher,项目名称:cakephp-queue,代码行数:23,代码来源:QueueTransportTest.php

示例11: contact

 public function contact()
 {
     $this->set('title_for_layout', 'Contact');
     if ($this->request->is('post')) {
         if ($this->request->data['captcha'] != $_SESSION['captcha']) {
             $this->Flash->error(__('Please enter correct captcha code and try again.', true));
         } else {
             //SEND EMAIL
             $email = new Email();
             $email->transport('default');
             $email->from([$this->request->data['email'] => $this->request->data['name']])->to(Configure::read('cakeblog_contact_email'))->subject('Website Contact - ' . $this->request->data['type'])->send($this->request->data['message']);
             $this->Flash->success(__('Your message has been submitted'));
             return $this->redirect("" . Configure::read('BASE_URL') . "/contact");
         }
     }
     //RENDER THEME VIEW
     $this->render('' . Configure::read('cakeblog_theme') . '.contact');
 }
开发者ID:keremcankaya0,项目名称:CakeBlog,代码行数:18,代码来源:ContactController.php

示例12: sendMail

 public function sendMail($to, $subject, $from, $message, $attachments = null, $emailCofig = 'default', $emailtemplate = 'default', $formate = 'html', $replyto = null, $cc = null, $bcc = null)
 {
     $email = new Email('default');
     $email->emailFormat($formate);
     $email->from(array($from => Configure::read('FROM_EMAIL_NAME')));
     $email->to($to);
     $email->cc($cc);
     $email->bcc($bcc);
     $email->replyTo($replyto);
     $email->subject($subject);
     $email->template($emailtemplate, 'default');
     //        $email->attachments($attachments);
     if ($email->send($message)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:mayurgodhanii,项目名称:cakephp_mailcomponent,代码行数:18,代码来源:MailerComponent.php

示例13: _generateEmails

 private function _generateEmails($loggedUser = null, $OrderingCustomer = null, $orderTotal = null, $order = null, $shopcart = null)
 {
     //choose to send email for new orders from here as well. with item list, customer details,
     //send an email to rick letting him know that an order was placed.
     //Send email to customer with their new reset password hashed link/url
     //create email object and set email config settings
     $orderEmail = new Email('default');
     $orderEmail->transport('default');
     //set the type of email format and use our custom template.
     $orderEmail->emailFormat('html');
     $orderEmail->template('order_email');
     //Set the email headers.
     $orderEmail->from(['solemateDoormats@doNotReply.com' => 'Solemate Doormats Web Orders']);
     $orderEmail->sender(['solemate.doormats@gmail.com' => 'Solemate Doormats inc']);
     $orderEmail->replyTo('solemate.doormats@gmail.com');
     $fullOrderUrl = Router::url(array('controller' => 'Orders', 'action' => 'view', $order->id), true);
     //send the administrator order created email with listing of items, weights, totals etc
     //set the email to send to
     $orderEmail->to(Configure::read('orderRecievedEmail'));
     $orderEmail->subject('Solemate Order has been placed on ' . date("Y-m-d"));
     $message = "<table id='orderEmailTable' style='border: 1'><tr><th>Item Name</th><th>Item Cost (per Unit)</th><th>Base Weight (per Unit)</th>";
     $message .= "<th>Total Wieght Ordered</th><th>Number of Bales</th></tr>";
     foreach ($shopcart as $item) {
         $message .= "<tr><td>" . $item['item_name'] . "</td>" . "<td>" . $item['base_price'] . "</td><td>" . $item['matt_weight'];
         $message .= "</td><td>" . h($item['matt_weight'] * $item['_joinData']['quantity']) . "</td><td>" . h($item['_joinData']['quantity'] / $item['matt_bale_count']) . "</td>";
     }
     $message .= "</tr></table>";
     //send email with body message of
     $orderEmail->send('Hi there Solemate Admin, this is an automated email to let you know a new order has been placed on the website ordering system,' . ' the order id is ' . $order->id . '. The customer placing the order was ' . $OrderingCustomer['first_name'] . ' ' . $OrderingCustomer['last_name'] . ', and was placed by the user: ' . $loggedUser['username'] . ' who has the role of ' . $this->request->session()->read('userRole') . ' user type. ' . ' The url to view to this order is <a href="' . $fullOrderUrl . '">' . $OrderingCustomer['first_name'] . ' ' . $OrderingCustomer['last_name'] . '\'s New Order</a> you will need to log in if you have not already done so recently. The invoice total will be (inc GST)$' . $orderTotal . '<br />' . $message);
     //set the email touser letting them know of their order items and total.
     $orderEmail1 = new Email('default');
     $orderEmail1->transport('default');
     //set the type of email format and use our custom template.
     $orderEmail1->emailFormat('html');
     $orderEmail1->template('order_email');
     //Set the email headers.
     $orderEmail1->from(['solemateDoormats@doNotReply.com' => 'Solemate Doormats Web Orders']);
     $orderEmail1->sender(['solemate.doormats@gmail.com' => 'Solemate Doormats inc']);
     $orderEmail1->replyTo('solemate.doormats@gmail.com');
     $orderEmail1->to($loggedUser['email']);
     $orderEmail1->subject('Your Solemate Order was placed on ' . date("Y-m-d"));
     //send email with body message of
     $orderEmail1->send('Hi there ' . $loggedUser['username'] . ', this is an automated email to let you know your order has been placed on the Solemate ordering system and our sales team will be in touch with the invoice and payment details.' . '<br />Order id is ' . $order->id . ', and was placed by the user: ' . $loggedUser['username'] . ' who has the role of ' . $this->request->session()->read('userRole') . ' user type. ' . ' The url to view to view details of this order is <a href="' . $fullOrderUrl . '">' . $OrderingCustomer['first_name'] . ' ' . $OrderingCustomer['last_name'] . '\'s New Order</a> you will need to log in if you have not already done so recently. The invoice total will be (inc GST)' . $orderTotal . '.');
     return true;
 }
开发者ID:eddiePower,项目名称:cakephp,代码行数:45,代码来源:ShopcartController.php

示例14: report

 public function report($id = null)
 {
     $resource = $this->Resources->get($id, ['contain' => ['Folders', 'Users', 'Vendors']]);
     if ($this->request->is(['post', 'put'])) {
         $users = $this->Users->find()->where(['role' => 'admin', 'status' => 'Y']);
         foreach ($users as $user) {
             $admins[] = $user->email;
         }
         $msg = "\nFile ID: {$resource->id}<br />\nFile: {$resource->sourcepath}<br />\nOwner: {$resource->user->username}<br />\nVendor: {$resource->vendor->company_name}<br />\nFile URL: {$resource->publicurl}<br />\n<br />\n            ";
         $msg .= $this->request->data['message'];
         $fgemail = new Email('default');
         $fgemail->sender($this->portal_settings['site_email'], $this->portal_settings['site_name']);
         $fgemail->from([$this->portal_settings['site_email'] => $this->portal_settings['site_name']])->to($admins)->subject(__('Resource Abuse Report'))->emailFormat('both')->send($msg);
         $this->Flash->success('The resource has been reported for abuse.');
         return $this->redirect(['controller' => 'PartnerResources', 'action' => 'navigate', $resource->folder_id]);
     }
     $this->set('resource', $resource);
 }
开发者ID:franky0930,项目名称:MarketingConnex,代码行数:18,代码来源:PartnerResourcesController.php

示例15: _prepareFromAddress

 /**
  * Prepares the `from` email address.
  *
  * @param \Cake\Network\Email\Email $email Email instance
  * @return array
  */
 protected function _prepareFromAddress($email)
 {
     $from = $email->returnPath();
     if (empty($from)) {
         $from = $email->from();
     }
     return $from;
 }
开发者ID:wepbunny,项目名称:cake2,代码行数:14,代码来源:SmtpTransport.php


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