Пример #1
0
 /**
  * @param Mail $mail
  * @throws MailException
  */
 public function send(Mail $mail)
 {
     $body = $mail->getHtmlOrText();
     $message = array('subject' => $mail->getSubject(), 'to' => $this->getTo($mail), 'images' => $this->getImages($mail));
     if ($mail->isHTML()) {
         $message['html'] = $body;
     }
     if ($text = $mail->getText()) {
         $message['text'] = $text;
     }
     if ($mail->getFrom()) {
         $message['from_email'] = $mail->getFrom()->getEmail();
         if ($mail->getFrom()->getName()) {
             $message['from_name'] = $mail->getFrom()->getName();
         }
     } else {
         throw new MailException("Mandrill requires a FROM email address to be set.");
     }
     $headers = array();
     if ($mail->getReplyTo()) {
         $headers['Reply-To'] = $mail->getReplyTo()->getEmail();
     }
     if (count($headers) > 0) {
         $message['headers'] = $headers;
     }
     $result = $this->mandrill->messages->send($message);
 }
Пример #2
0
 public function sendConfirmationEmail(Module $module)
 {
     return;
     $template = new Template('CatLab/Accounts/mails/confirmation.phpt');
     $template->set('user', $this);
     $mail = new Mail();
     $mail->setSubject('Email verification');
     $mail->setTemplate($template);
     $mail->getTo()->add($this->getEmail());
     $mail->setFrom(Config::get('mailer.from.email'));
     Mailer::getInstance()->send($mail);
 }