public function send(MailInterface $mail)
 {
     if (!$mail instanceof MandrillTemplateMail) {
         throw new RuntimeException(sprintf("Mail must be of instance %s to be sent using %s", MandrillTemplateMail::class, MandrillTemplateMailer::class));
     }
     $message = array('subject' => $mail->getSubject(), 'from_email' => $mail->getFromEmail(), 'from_name' => $mail->getFromName(), 'to' => array($mail->getTo()), 'headers' => array('Reply-To' => '*****@*****.**'), 'important' => false, 'track_opens' => false, 'track_clicks' => false, 'auto_text' => false, 'auto_html' => false, 'inline_css' => false, 'url_strip_qs' => false, 'preserve_recipients' => false, 'view_content_link' => false, 'merge' => true, 'merge_language' => 'mailchimp', 'global_merge_vars' => $this->globalMergeVars, 'merge_vars' => array($mail->getMergeVars()), 'tags' => $mail->getTags());
     $async = false;
     $ipPool = 'Main Pool';
     $result = $this->mandrill->messages->sendTemplate($this->templateName, $this->templateContent, $message, $async, $ipPool);
     return $result;
 }
Beispiel #2
0
 public function send(MailInterface $mail)
 {
     if (!$mail instanceof PhpMailerMail) {
         throw new RuntimeException(sprintf("Mail must be of instance %s to be sent using %s", PhpMailerMail::class, PhpMailer::class));
     }
     $receiver = $mail->getTo();
     $this->phpMailer->Subject = $mail->getSubject();
     $this->phpMailer->Body = $mail->getBody();
     $this->phpMailer->From = $mail->getFromEmail();
     $this->phpMailer->FromName = $mail->getFromName();
     $this->phpMailer->WordWrap = 50;
     $this->phpMailer->addAddress($receiver['email'], $receiver['name']);
     $this->phpMailer->addReplyTo($mail->getFromEmail(), $mail->getFromName());
     $this->phpMailer->isHTML(true);
     if (!$this->phpMailer->send()) {
         throw new \RuntimeException($this->phpMailer->ErrorInfo);
     }
 }