本文整理汇总了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');
}
示例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);
}
示例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);
}
示例4: addFrom
/**
* {@inheritdoc}
*
* @return $this|self
*/
public function addFrom($address, $name = null) : self
{
$this->message->addFrom($address, $name);
return $this;
}
示例5: addFrom
public function addFrom(Email $email)
{
$this->message->addFrom($email->email, $email->name);
return $this;
}
示例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);
}
}
示例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;
}