function sendHTML($to, $from, $subject, $htmlContent, $attachedFiles = false, $customheaders = false, $plainContent = false)
 {
     $cssFileLocation = Director::baseFolder() . Config::inst()->get("EmogrifierMailer", "css_file");
     $cssFileHandler = fopen($cssFileLocation, 'r');
     $css = fread($cssFileHandler, filesize($cssFileLocation));
     fclose($cssFileHandler);
     $emog = new \Pelago\Emogrifier($htmlContent, $css);
     $htmlContent = $emog->emogrify();
     return parent::sendHTML($to, $from, $subject, $htmlContent, $attachedFiles, $customheaders, $plainContent);
 }
 /**
  * Send an email as both HTML and plaintext
  * 
  * @return bool
  */
 public function sendHTML($to, $from, $subject, $htmlContent, $attachedFiles = false, $customheaders = false, $plainContent = false)
 {
     $result = $this->sendPostmarkEmail($to, $from, $subject, $htmlContent, $attachedFiles, $customheaders, $plainContent);
     if ($result === false) {
         // Fall back to regular Mailer
         $fallbackMailer = new Mailer();
         $result = $fallbackMailer->sendHTML($to, $from, $subject, $htmlContent, $attachedFiles, $customheaders, $plainContent);
     }
     return $result;
 }
 /**
  * Send a multi-part HTML email.
  * 
  * @return bool
  */
 function sendHTML($to, $from, $subject, $htmlContent, $attachedFiles = false, $customheaders = false, $plainContent = false, $inlineImages = false)
 {
     if (parent::sendHTML($to, $from, $subject, $htmlContent, $attachedFiles = false, $customheaders = false, $plainContent = false, $inlineImages = false)) {
         $log = new MailLog();
         $log->To = $to;
         $log->From = $from;
         $log->Subject = $subject;
         $log->Body = $htmlContent;
         $log->Date = date('Y-m-d H:i:s');
         $log->write();
     } else {
         throw new Exception("Mail not accepted for delivery to {$to}");
     }
 }
 /**
  * Send a multi-part HTML email
  * TestMailer will merely record that the email was asked to be sent, without sending anything.
  */
 function sendHTML($to, $from, $subject, $htmlContent, $attachedFiles = false, $customHeaders = false, $plainContent = false, $inlineImages = false)
 {
     if (self::$capture_emails) {
         $mail = new CapturedEmail();
         $mail->To = $to;
         $mail->From = $from;
         $mail->Subject = $subject;
         if (is_array($customHeaders)) {
             foreach ($customHeaders as $header => $val) {
                 $mail->Headers .= "{$header}: {$val} \n";
             }
         }
         $mail->Content = $htmlContent;
         $mail->PlainText = $plainContent;
         if ($this->send) {
             $mail->SendID = $this->send->ID;
         }
         $mail->write();
     }
     if (self::$outbound_send) {
         return parent::sendHTML($to, $from, $subject, $htmlContent, $attachedFiles, $customHeaders, $plainContent, $inlineImages);
     }
     return true;
 }
 public function sendHTML($to, $from, $subject, $htmlContent, $attachedFiles = false, $customheaders = false, $plainContent = false)
 {
     $htmlContent = InlineStyler::convert($htmlContent);
     return parent::sendHTML($to, $from, $subject, $htmlContent, $attachedFiles, $customheaders, $plainContent);
 }
 /**
  * Sends an email as a both HTML and plaintext
  *
  * @param string $to Email recipient
  * @param string $from Email from
  * @param string $subject Subject text
  * @param string $htmlContent HTML Content
  * @param array $attachedFiles List of attachments
  * @param array $customHeaders User specified headers
  * @param string $plainContent Plain text content.
  * 							   If omitted, will be generated from $htmlContent
  * @return mixed Return false if failure, or list of arguments if success
  */
 public function sendHTML($to, $from, $subject, $htmlContent, $attachedFiles = array(), $customHeaders = array(), $plainContent = '')
 {
     $rewrites = $this->mailblockRewrite($to, $subject, $customHeaders);
     parent::sendHTML($rewrites['to'], $from, $rewrites['subject'], $htmlContent, $attachedFiles, $rewrites['headers'], $plainContent);
 }