當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。