/** * Get Html Mail with a view. * @param type $mailView * @param type $params * @param type $to * @param type $from * @param type $subject * @return \flowcode\pachamama\domain\Mail * @throws MailViewException */ public static function getHtmlMail($mailView, $params, $to, $from, $subject) { if (file_exists($mailView)) { ob_start(); require_once $mailView; $body = ob_get_contents(); ob_end_clean(); } else { throw new MailViewException($mailView); } $mail = new MailMessage($to, $from, $body, $subject); $headers = "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n" . "From: =?UTF-8?B?" . base64_encode($params["from_name"]) . "?= <" . $from . ">\r\n" . "X-Mailer: PHP/" . phpversion(); $mail->setHeaders($headers); return $mail; }