/** * Send a multi-part HTML email with inlined CSS * * @param string $to * @param string $from * @param string $subject * @param string $htmlContent * @param array|bool $attachedFiles * @param array|bool $customheaders * @param bool $plainContent * @param bool $inlineImages * * @return bool */ public function sendHTML($to, $from, $subject, $htmlContent, $attachedFiles = false, $customheaders = false, $plainContent = false, $inlineImages = false) { $mail = $this->initEmail($to, $from, $subject, $attachedFiles, $customheaders); // set up the body // @todo inlineimages $mail->Body = InlineCSS::convert($htmlContent, $this->getCSSfile()); $mail->IsHTML(true); if ($plainContent) { $mail->AltBody = $plainContent; } if ($level = $this->getSMTPDebug()) { $mail->SMTPDebug = $level; $mail->Debugoutput = function ($str, $level) { SS_Log::log(print_r($str, true), SS_Log::NOTICE); }; } // send and return if ($mail->Send()) { return array($to, $subject, $mail->Body, $customheaders); } else { if ($this->getLogfailedemail()) { SS_Log::log(print_r($mail->ErrorInfo, true), SS_Log::NOTICE); } return false; } }
/** * Send a multi-part HTML email with inlined CSS * * @param string $to * @param string $from * @param string $subject * @param string $htmlContent * @param array|bool $attachedFiles * @param array|bool $customheaders * @param bool $plainContent * @param bool $inlineImages * * @return bool */ public function sendHTML($to, $from, $subject, $htmlContent, $attachedFiles = false, $customheaders = false, $plainContent = false, $inlineImages = false) { $mail = $this->initEmail($to, $from, $subject, $attachedFiles, $customheaders); // set up the body // @todo inlineimages $mail->Body = InlineCSS::convert($htmlContent, $this->getCSSfile()); $mail->IsHTML(true); if ($plainContent) { $mail->AltBody = $plainContent; } // send and return if ($mail->Send()) { return array($to, $subject, $mail->Body, $customheaders); } else { return false; } }