Exemplo n.º 1
0
 public function getItemTrialCount(MailQueueItem $mailQueueItem)
 {
     return $mailQueueItem->getNumberOfTrials();
 }
 public function convert(MailMessage $mailMessage, EmailAddress $from, EmailAddress $recipient, EmailAddress $replyTo = null)
 {
     $mailQueueItem = new MailQueueItem();
     $mailQueueItem->setFromMail($from->getAddress());
     $mailQueueItem->setFromName($from->getName());
     $mailQueueItem->setToMail($recipient->getAddress());
     $mailQueueItem->setToName($recipient->getName());
     if ($replyTo) {
         $mailQueueItem->setReplyToMail($replyTo->getAddress());
         $mailQueueItem->setReplyToName($replyTo->getName());
     }
     $mailQueueItem->setSubject($mailMessage->getSubject());
     $mailQueueItem->setTextBody($mailMessage->getTextBody());
     $mailQueueItem->setHtmlBody($mailMessage->getHtmlBody());
     $mailQueueItem->setTemplateName($mailMessage->getTemplateName());
     $mailQueueItem->setLanguage($mailMessage->getLanguage());
     $mailQueueItem->setCreatedOn($this->dateTimeFactory->getCurrentDateTime()->toDateTime());
     return $mailQueueItem;
 }
Exemplo n.º 3
0
 public function send(MailQueueItem $mailQueueItem)
 {
     $message = Swift_Message::newInstance();
     $message->setSubject($mailQueueItem->getSubject());
     $message->setFrom($mailQueueItem->getFromMail(), $mailQueueItem->getFromName());
     $message->setTo($mailQueueItem->getToMail(), $mailQueueItem->getToName());
     $message->setBody($mailQueueItem->getTextBody());
     if ($mailQueueItem->getHtmlBody()) {
         $message->addPart($mailQueueItem->getHtmlBody(), 'text/html');
     }
     if ($mailQueueItem->getReplyToMail()) {
         $message->setReplyTo($mailQueueItem->getReplyToMail(), $mailQueueItem->getReplyToName());
     }
     $this->swiftMailer->send($message);
 }