Esempio n. 1
0
 /**
  * Send a mail or add to spool, then log to db.
  * @param  Mail $mail
  * @param  Journal $journal
  * @return integer
  */
 public function send(Mail $mail, Journal $journal)
 {
     if (isset($mail->template)) {
         $mail->templateData = isset($mail->templateData) ? $mail->templateData : array();
         $mail->body = $this->templating->render($mail->template, $mail->templateData);
     }
     if (!isset($mail->from)) {
         $mail->from = $this->systemEmail;
     }
     if ($journal) {
         $mail->body .= $journal->getSetting('emailSignature');
     }
     $message = \Swift_Message::newInstance()->setSubject($mail->subject)->setFrom($mail->from)->setTo($mail->to)->setBody($mail->body)->setContentType('text/html');
     return $this->mailer->send($message);
 }