Beispiel #1
0
 public function send(MailMessage $message)
 {
     if (!$this->success) {
         throw new \Swift_SwiftException("Problem sending email.", 1);
         return false;
     }
     $this->times++;
     $this->message = $message;
     $this->to = $message->getTo();
     return true;
 }
 public function send(MailMessage $message)
 {
     $swiftMessage = \Swift_Message::newInstance()->setSubject($message->getSubject())->setFrom($message->getSender())->setReplyTo($message->getReplyTo())->setTo($message->getTo())->setBody($message->getBody());
     foreach ($message->getParts() as $part) {
         $swiftMessage->addPart($part['part'], $part['type']);
     }
     foreach ($message->getAttachments() as $attachment) {
         $swiftMessage->attach(\Swift_Attachment::fromPath($attachment));
     }
     return $this->swift->send($swiftMessage);
 }
 public function send(MailMessage $message)
 {
     $template = $this->templating->loadTemplate($message->getTemplate());
     $message->setSubject($template->renderBlock('subject', $message->getData()))->setSender($message->getSender())->setReplyTo(key($message->getSender()))->setTo($message->getTo())->setBody($template->renderBlock('body_text', $message->getData()))->addPart($template->renderBlock('body_html', $message->getData()), 'text/html');
     return $this->mailer->send($message);
 }