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


PHP Email::emailFormat方法代码示例

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


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

示例1: gmail

 public function gmail()
 {
     $email = new Email('gmail-profile');
     $email->emailFormat('html')->template('compra', 'default')->viewVars(['nombres' => 'Erick Benites', 'producto' => 'CakePHPCookbook'])->to('erick.benites@gmail.com')->subject('Correo desde CakePHP 3 con Gmail')->attachments(['CakePHPCookbook.pdf' => WWW_ROOT . 'CakePHPCookbook.pdf', 'photo.png' => ['file' => WWW_ROOT . 'img/logo.png', 'mimetype' => 'image/png', 'contentId' => 'logo-id']])->send("Contenido adicional ... \n ...");
     echo 'Correo enviado';
     $this->autoRender = false;
 }
开发者ID:ebenites,项目名称:cakephp,代码行数:7,代码来源:CorreoController.php

示例2: registration

 public function registration()
 {
     if ($this->request->is('post')) {
         $first_name = $this->request->data['first_name'];
         $last_name = $this->request->data['last_name'];
         $bussiness_name = $this->request->data['bussiness_name'];
         $email = $this->request->data['email'];
         $mobile = $this->request->data['mobile'];
         $msg = '<h3>Registration Successfull. Following is the user detail.</h3><br><br><br>';
         $msg .= '<strong>First Name : </strong>' . $first_name . '<br>';
         $msg .= '<strong>Last Name : </strong>' . $last_name . '<br>';
         $msg .= '<strong>Bussiness Name : </strong>' . $bussiness_name . '<br>';
         $msg .= '<strong>Email : </strong>' . $email . '<br>';
         $msg .= '<strong>Mobile : </strong>' . $mobile . '<br>';
         $email = new Email('default');
         $res = $email->emailFormat('html')->from(['partners@terra-app.com' => 'Terraapp User'])->to('partners@terra-app.com')->subject('Registration')->send($msg);
         if (!empty($res)) {
             $data = '<div class="showSuccess">Registration Successfull.</div>';
             echo json_encode(array('response' => 1, 'data' => $data));
         } else {
             $data = '<div class="showSuccess">Error in registration.</div>';
             echo json_encode(array('response' => 0, 'data' => $data));
         }
         exit;
     }
 }
开发者ID:rstrigma,项目名称:temporary,代码行数:26,代码来源:PagesController.php

示例3: _getEmailInstance

 /**
  * Get or initialize the email instance. Used for mocking.
  *
  * @param Email $email if email provided, we'll use the instance instead of creating a new one
  * @return Email
  */
 protected function _getEmailInstance(Email $email = null)
 {
     if ($email === null) {
         $email = new Email('default');
         $email->emailFormat('both');
     }
     return $email;
 }
开发者ID:drmonkeyninja,项目名称:users,代码行数:14,代码来源:Behavior.php

示例4: send

 /**
  * send email
  *
  * @access public
  * @author sakuragawa
  */
 public function send($config, $code, $errorType, $description, $file, $line, $context)
 {
     $subject = $this->subject($config, $errorType, $description);
     $body = $this->body($config, $description, $file, $file, $context);
     $format = 'text';
     if ($config['mail']['html'] === true) {
         $format = 'html';
     }
     $email = new Email('error');
     $email->emailFormat($format)->subject($subject)->send($body);
 }
开发者ID:fusic,项目名称:encount,代码行数:17,代码来源:Mail.php

示例5: email

 /**
  * View single order
  * @param $id
  */
 public function email($id)
 {
     $row = $this->Orders->findById($id)->contain(["Users", "Statuses", "Operations", "Accessories", "Images", "Files"])->first();
     if (!$row) {
         throw new InternalErrorException("Chyba pri nacitani objednavky", 500);
     }
     $email = new Email();
     $email->emailFormat('html')->template('order_client')->transport('default')->viewVars(['message' => $this->request->data('message'), 'row' => $row, 'name' => $row['user']['name'], 'username' => $row['user']['username']])->to($this->request->data('email'))->from($row['user']['username'])->subject($this->request->data('subject') . ' -  taznezariadenia.sk')->send();
     $this->set('row', $row);
     $this->set('_serialize', ['row']);
 }
开发者ID:ranostaj,项目名称:autocar,代码行数:15,代码来源:OrdersController.php

示例6: mailer

 /**
  * mailer method
  *
  * @param array $data Dados para formar o email.
  * @return boolean True ou False.
  */
 public function mailer($data, $template, $subject)
 {
     $email = new Email();
     $email->transport('mailSgl');
     $email->emailFormat('html');
     $email->template($template);
     $email->from('sglmailer@gmail.com', 'SGL');
     $email->to($data['email'], $data['nome']);
     $email->viewVars($data);
     $email->subject($subject);
     $email->send();
 }
开发者ID:daniels85,项目名称:SGL,代码行数:18,代码来源:AppController.php

示例7: testSendWithEmail

 /**
  * TestSend method
  *
  * @return void
  */
 public function testSendWithEmail()
 {
     $config = ['transport' => 'queue', 'charset' => 'utf-8', 'headerCharset' => 'utf-8'];
     $this->QueueTransport->config($config);
     $Email = new Email($config);
     $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->attachments(['wow.txt' => ['data' => 'much wow!', 'mimetype' => 'text/plain', 'contentId' => 'important']]);
     $Email->template('test_template', 'test_layout');
     $Email->subject("L'utilisateur n'a pas pu être enregistré");
     $Email->replyTo('noreply@cakephp.org');
     $Email->readReceipt('noreply2@cakephp.org');
     $Email->returnPath('noreply3@cakephp.org');
     $Email->domain('cakephp.org');
     $Email->theme('EuroTheme');
     $Email->emailFormat('both');
     $Email->set('var1', 1);
     $Email->set('var2', 2);
     $result = $this->QueueTransport->send($Email);
     $this->assertEquals('Email', $result['jobtype']);
     $this->assertTrue(strlen($result['data']) < 10000);
     $output = unserialize($result['data']);
     $emailReconstructed = new Email($config);
     foreach ($output['settings'] as $method => $setting) {
         call_user_func_array([$emailReconstructed, $method], (array) $setting);
     }
     $this->assertEquals($emailReconstructed->from(), $Email->from());
     $this->assertEquals($emailReconstructed->to(), $Email->to());
     $this->assertEquals($emailReconstructed->cc(), $Email->cc());
     $this->assertEquals($emailReconstructed->bcc(), $Email->bcc());
     $this->assertEquals($emailReconstructed->subject(), $Email->subject());
     $this->assertEquals($emailReconstructed->charset(), $Email->charset());
     $this->assertEquals($emailReconstructed->headerCharset(), $Email->headerCharset());
     $this->assertEquals($emailReconstructed->emailFormat(), $Email->emailFormat());
     $this->assertEquals($emailReconstructed->replyTo(), $Email->replyTo());
     $this->assertEquals($emailReconstructed->readReceipt(), $Email->readReceipt());
     $this->assertEquals($emailReconstructed->returnPath(), $Email->returnPath());
     $this->assertEquals($emailReconstructed->messageId(), $Email->messageId());
     $this->assertEquals($emailReconstructed->domain(), $Email->domain());
     $this->assertEquals($emailReconstructed->theme(), $Email->theme());
     $this->assertEquals($emailReconstructed->profile(), $Email->profile());
     $this->assertEquals($emailReconstructed->viewVars(), $Email->viewVars());
     $this->assertEquals($emailReconstructed->template(), $Email->template());
     //for now cannot be done 'data' is base64_encode on set but not decoded when get from $email
     //$this->assertEquals($emailReconstructed->attachments(),$Email->attachments());
     //debug($output);
     //$this->assertEquals($Email, $output['settings']);
 }
开发者ID:alexandreanfilo,项目名称:cakephp-queue,代码行数:56,代码来源:SimpleQueueTransportTest.php

示例8: _sendActivationEmail

 /**
  * Send an activation link to user email
  * @param $user
  */
 public function _sendActivationEmail(Entity $user, $url = '/register/active/')
 {
     $ActivationKeys = TableRegistry::get('Users.ActivationKeys');
     $activationKeyEntity = $ActivationKeys->newEntity();
     $activationKeyEntity->user_id = $user->id;
     do {
         $activationKeyEntity->activation_key = Text::uuid();
     } while (!$ActivationKeys->save($activationKeyEntity));
     //send email with activation key
     $activationUrl = Router::url($url . $activationKeyEntity->activation_key, true);
     $email = new Email('default');
     //        $email->transport();
     $email->emailFormat('html');
     $email->viewVars(compact('activationUrl'));
     $email->helpers(['Html']);
     $email->to($user->username);
     return $email;
 }
开发者ID:mohammadsaleh,项目名称:spider,代码行数:22,代码来源:AppController.php

示例9: comprar

 public function comprar()
 {
     if ($this->request->is('post')) {
         $carrito = $this->request->session()->read('carrito');
         if (!$carrito) {
             $carrito = array();
         }
         $nombres = $this->request->data('nombres');
         $correo = $this->request->data('correo');
         $email = new Email('default');
         // Seleccionar el profile a usar
         $email->emailFormat('html')->template('pedido')->viewVars(['nombres' => $nombres, 'carrito' => $carrito])->from(['tienda@tecsup.edu.pe' => 'Tienda Online'])->to($correo)->cc('ebenites@tecsup.edu.pe')->subject('Agradecemos su pedido')->send();
         // Eliminar la sesion y los datos del carrito
         $this->request->session()->destroy();
         $this->Flash->success('Su pedido está siendo procesado. ¡Muchas gracias!');
         $this->redirect(['action' => 'index']);
     }
 }
开发者ID:ebenites,项目名称:cakephp,代码行数:18,代码来源:CarritoController.php

示例10: sendNewMissionsToInterestedUsers

 public function sendNewMissionsToInterestedUsers($nbrDays = 7)
 {
     $created = Time::now()->subDays($nbrDays);
     $missions = $this->Missions->find('all', ['conditions' => ['Missions.created >=' => $created]])->toArray();
     $newMissions = [];
     foreach ($missions as $mission) {
         $users = $this->Users->find('all')->toArray();
         foreach ($users as $user) {
             $usersTypeMissions = $this->UsersTypeMissions->findByUserId($user['id'])->toArray();
             foreach ($usersTypeMissions as $userTypeMissions) {
                 // Check if the current mission has the same type has the current userType mission
                 if ($userTypeMissions['type_mission_id'] == $mission['type_mission_id']) {
                     // Add a new mission to the list of missions to send
                     if (isset($newMissions[$user['email']])) {
                         $newMission = [];
                         $newMission['link'] = Router::url(['controller' => 'Missions', 'action' => 'view', $mission['id']]);
                         $newMission['name'] = $mission['name'];
                         //print("Mission " . $newMission['name'] . " added to user " . $user['email'] . "\n");
                         array_push($newMissions[$user['email']], $newMission);
                     } else {
                         //print("Creating mission list for user " . $user['email'] . "\n");
                         $newMissions[$user['email']] = [];
                         $newMission = [];
                         $newMission['link'] = Router::url(['controller' => 'Missions', 'action' => 'view', $mission['id']]);
                         $newMission['name'] = $mission['name'];
                         //print("Mission " . $newMission['name'] . " added to user " . $user['email'] . "\n");
                         array_push($newMissions[$user['email']], $newMission);
                     }
                 }
             }
         }
     }
     // For each user send their associated list of missions
     foreach ($newMissions as $userEmail => $missionsToSend) {
         $email = new Email();
         $email->domain('maisonlogiciellibre.org');
         $email->to($userEmail);
         $email->subject('New missions available at ML2');
         $email->template('new_missions');
         $email->emailFormat('both');
         $email->viewVars(['missions' => $missionsToSend]);
         $email->send();
     }
 }
开发者ID:fxleblanc,项目名称:Website,代码行数:44,代码来源:SendMailShell.php

示例11: send

 /**
  * Send mail
  *
  * @param \Cake\Mailer\Email $email Email
  * @return array
  */
 public function send(Email $email)
 {
     if (!empty($this->_config['queue'])) {
         $this->_config = $this->_config['queue'] + $this->_config;
         $email->config((array) $this->_config['queue'] + ['queue' => []]);
         unset($this->_config['queue']);
     }
     $settings = ['from' => [$email->from()], 'to' => [$email->to()], 'cc' => [$email->cc()], 'bcc' => [$email->bcc()], 'charset' => [$email->charset()], 'replyTo' => [$email->replyTo()], 'readReceipt' => [$email->readReceipt()], 'returnPath' => [$email->returnPath()], 'messageId' => [$email->messageId()], 'domain' => [$email->domain()], 'getHeaders' => [$email->getHeaders()], 'headerCharset' => [$email->headerCharset()], 'theme' => [$email->theme()], 'profile' => [$email->profile()], 'emailFormat' => [$email->emailFormat()], 'subject' => method_exists($email, 'getOriginalSubject') ? [$email->getOriginalSubject()] : [$email->subject()], 'transport' => [$this->_config['transport']], 'attachments' => [$email->attachments()], 'template' => $email->template(), 'viewVars' => [$email->viewVars()]];
     foreach ($settings as $setting => $value) {
         if (array_key_exists(0, $value) && ($value[0] === null || $value[0] === [])) {
             unset($settings[$setting]);
         }
     }
     $QueuedJobs = $this->getQueuedJobsModel();
     $result = $QueuedJobs->createJob('Email', ['settings' => $settings]);
     $result['headers'] = '';
     $result['message'] = '';
     return $result;
 }
开发者ID:dereuromark,项目名称:cakephp-queue,代码行数:25,代码来源:SimpleQueueTransport.php

示例12: index

 public function index($locale = null)
 {
     $this->localeSite($locale);
     $commentsTable = TableRegistry::get('userComments');
     $comments = $commentsTable->find()->select(['first_name', 'picture', 'comment'])->where(['approved = 1'])->toArray();
     if ($this->request->is('post')) {
         $message = "";
         foreach ($this->request->data as $key => $value) {
             if (!empty($value)) {
                 $message .= $key . ": " . $value . "<br />";
             }
         }
         $email = new Email('primegroupbr');
         if ($email->emailFormat('html')->to('contato@primegroupbr.com')->subject('Contato')->send($message)) {
             $this->Flash->success('Your contact has been sent.');
         }
     }
     $this->set('comments', $comments);
 }
开发者ID:albertoneto,项目名称:localhost,代码行数:19,代码来源:FrontEndController.php

示例13: sendExtNotify

 public function sendExtNotify($from, $to, $template = "default", $subject = "", $content)
 {
     $this->Users = TableRegistry::get('Users');
     // Don't Sent Message From Self to Self
     if ($from == $to) {
         return false;
     }
     $toUser = $this->Users->findById($to)->first();
     $fromUser = $this->Users->findById($from)->first();
     // Unable to load either user.  This is bad.
     if (empty($toUser)) {
         return false;
     }
     if (empty($fromUser)) {
         return false;
     }
     // Don't send to a non-notified user
     if (!$toUser->is_notified) {
         return false;
     }
     $email = new Email('default');
     $email->emailFormat('both')->template($template)->to($toUser->username)->cc($fromUser->username)->subject($subject)->viewVars($content)->send();
     return true;
 }
开发者ID:jtsage,项目名称:TDTracX,代码行数:24,代码来源:MailMsgComponent.php

示例14: forgot

 /**
  * Save new user
  *
  */
 public function forgot()
 {
     $username = $this->request->data('username');
     $user = $this->Users->find()->where(['username' => $this->request->data('username')])->first();
     if (!$user) {
         $this->response->header('HTTP/1.1', '500 Internal Server Error');
         $err[] = "Užívateľ nebol najdený";
         $this->set('errors', $err);
         $this->set('_serialize', ['errors']);
     } else {
         $user->new_pass = $this->generateRandomString(6);
         $this->Users->save($user);
         $email = new Email();
         $email->emailFormat('html')->template('forgot')->transport('default')->viewVars(['hash' => sha1($user->new_pass), 'password' => $user->new_pass])->to($username)->from($username)->subject('Reset hesla -  taznezariadenia.sk')->send();
         $this->set('user', $user->new_pass);
         $this->set('_serialize', ['user']);
     }
 }
开发者ID:ranostaj,项目名称:autocar,代码行数:22,代码来源:UsersController.php

示例15: Email

 function forgot_password()
 {
     if (!is_null($this->Auth->user('id'))) {
         $this->Flash->error(__('You have not forgotten your password, you are logged in.'));
         return $this->redirect('/');
     }
     if ($this->request->is(['post']) && !empty($this->request->data(['username']))) {
         $userReset = $this->Users->findByUsername($this->request->data['username'])->first();
         if (empty($userReset)) {
             $this->Flash->error(__('Password reset instructions sent.  You have 24 hours to complete this request.'));
             return $this->redirect('/');
         } else {
             $userReset = $this->__genPassToken($userReset);
             if ($this->Users->save($userReset)) {
                 $email = new Email('default');
                 $email->emailFormat('both')->template('reset')->to($userReset->username)->subject('Password Reset Requested')->viewVars(['username' => $userReset->username, 'ip' => $_SERVER['REMOTE_ADDR'], 'hash' => $userReset->reset_hash, 'expire' => $userReset->reset_hash_time, 'fullURL' => "http://" . $_SERVER['HTTP_HOST'] . "/users/reset_password/"])->send();
                 $this->Flash->error(__('Password reset instructions sent.  You have 24 hours to complete this request.'));
                 return $this->redirect('/');
             }
         }
     }
 }
开发者ID:jtsage,项目名称:TDTracX,代码行数:22,代码来源:UsersController.php


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