當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Swift_Message::addFrom方法代碼示例

本文整理匯總了PHP中Swift_Message::addFrom方法的典型用法代碼示例。如果您正苦於以下問題:PHP Swift_Message::addFrom方法的具體用法?PHP Swift_Message::addFrom怎麽用?PHP Swift_Message::addFrom使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Swift_Message的用法示例。


在下文中一共展示了Swift_Message::addFrom方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: action_send

 /**
  * This is just for the demo sending.
  */
 public function action_send()
 {
     $message = new Swift_Message();
     $message->addTo($this->request->post('to'));
     $message->addFrom($this->request->post('from'));
     $message->setSubject($this->request->post('subject'));
     $message->setBody($this->request->post('message'));
     $mq = new MailQueue();
     $mq->add($message);
     $this->redirect('mailqueue/demo');
 }
開發者ID:samwilson,項目名稱:kohana_mailqueue,代碼行數:14,代碼來源:MailQueue.php

示例2: postPersist

 public function postPersist(LifecycleEventArgs $args)
 {
     $entity = $args->getEntity();
     // On veut envoyer un email que pour les entités Application
     if (!$entity instanceof Application) {
         return;
     }
     $message = new \Swift_Message('Nouvelle candidature', 'Vous avez reçu une nouvelle candidature.');
     $message->addFrom('admin@votresite.com');
     //$this->mailer->send($message);
 }
開發者ID:vincentmary,項目名稱:oc_sf,代碼行數:11,代碼來源:ApplicationNotification.php

示例3: sendMessage

 private function sendMessage($url, $username)
 {
     $message = new \Swift_Message('Vous avez reçu une demande!', "Félicitation, nous venons d'apprendre que {$username} est interessé par votre annonce:\n\n{$url}\n\nL'équipe Snoozit.\n         ");
     $message->addFrom('gautierkris@gmail.com')->addTo('gautierkris@gmail.com');
     $this->mailer->send($message);
 }
開發者ID:GautierKris,項目名稱:Snoozit,代碼行數:6,代碼來源:NegoceNotification.php

示例4: addFrom

 /**
  * {@inheritdoc}
  *
  * @return $this|self
  */
 public function addFrom($address, $name = null) : self
 {
     $this->message->addFrom($address, $name);
     return $this;
 }
開發者ID:cawaphp,項目名稱:email,代碼行數:10,代碼來源:Message.php

示例5: addFrom

 public function addFrom(Email $email)
 {
     $this->message->addFrom($email->email, $email->name);
     return $this;
 }
開發者ID:Webiny,項目名稱:Framework,代碼行數:5,代碼來源:Message.php

示例6: setupMessageHeaders

 /**
  * @param \Swift_Message $instance
  * @param  array  $from              From addresses. An array of (email-address => name)
  * @param  array  $to                To addresses. An array of (email-address => name)
  * @param  array  $cc                Cc addresses. An array of (email-address => name) [optional]
  * @param  array  $bcc               Bcc addresses. An array of (email-address => name) [optional]
  * @param  array  $replyTo           Reply to addresses. An array of (email-address => name) [optional]
  */
 protected function setupMessageHeaders($instance, $from, $to, $cc = [], $bcc = [], $replyTo = [])
 {
     // Add from addresses
     foreach ($from as $address => $name) {
         $instance->addFrom($address, $name);
     }
     // Add to addresses
     foreach ($to as $address => $name) {
         $instance->addTo($address, $name);
     }
     // Add cc addresses
     foreach ($cc as $address => $name) {
         $instance->addCc($address, $name);
     }
     // Add bcc addresses
     foreach ($bcc as $address => $name) {
         $instance->addBcc($address, $name);
     }
     // Add reply to addresses
     foreach ($replyTo as $address => $name) {
         $instance->addReplyTo($address, $name);
     }
 }
開發者ID:vigourouxjulien,項目名稱:thelia,代碼行數:31,代碼來源:MailerFactory.php

示例7: finishOrderViaTheForm

 public function finishOrderViaTheForm(FormInterface $form)
 {
     $cart = $this->loadCart();
     /** @var OrderEntity $entity */
     $entity = $form->getData();
     $entity->cart = $cart;
     try {
         $this->entity_manager->persist($entity);
         $this->entity_manager->flush();
         $data = ['name' => $entity->name, 'email' => $entity->email, 'cart' => $entity->cart, 'note' => $entity->note];
         $message = new \Swift_Message('Objednávka z webu Symfony.cz');
         $message->addFrom('symfony-eshop@zemistr.eu');
         $message->addTo($entity->email);
         $message->setBody($this->twig->render('AppBundle:Cart:email.html.twig', $data), 'text/html');
         $this->swift_mailer->send($message, $failed);
         $message = new \Swift_Message('Nová objednávka z webu Symfony.cz');
         $message->addFrom('symfony-eshop@zemistr.eu');
         $message->addTo('symfony-eshop@zemistr.eu');
         $message->setBody($this->twig->render('AppBundle:Cart:emailAdmin.html.twig', $data), 'text/html');
         $this->swift_mailer->send($message, $failed);
         $this->storeCart([]);
         return self::STATUS_OK;
     } catch (\Exception $e) {
     }
     return self::STATUS_ERROR;
 }
開發者ID:Zemistr,項目名稱:symfony-3-first-app,代碼行數:26,代碼來源:OrderService.php


注:本文中的Swift_Message::addFrom方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。