diff --git a/lib/SimpleSAML/XHTML/EMail.php b/lib/SimpleSAML/XHTML/EMail.php index a9e239029b44de780c892dbb55e7ef35bda688e2..fc5441ef4cdfebbda1e135af722cd7b7905aa982 100644 --- a/lib/SimpleSAML/XHTML/EMail.php +++ b/lib/SimpleSAML/XHTML/EMail.php @@ -5,7 +5,7 @@ namespace SimpleSAML\XHTML; /** * A minimalistic Emailer class. Creates and sends HTML emails. * - * @author Andreas kre Solberg, UNINETT AS. <andreas.solberg@uninett.no> + * @author Andreas Ă…kre Solberg, UNINETT AS. <andreas.solberg@uninett.no> * @package SimpleSAMLphp */ @@ -48,30 +48,10 @@ class EMail */ private function getHTML($body) { - return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <meta http-equiv="content-type" content="text/html; charset=utf-8" /> - <title>SimpleSAMLphp Email report</title> - <style type="text/css"> -pre, div.box { - margin: .4em 2em .4em 1em; - padding: 4px; - -} -pre { - background: #eee; - border: 1px solid #aaa; -} - </style> -</head> -<body> -<div class="container" style="background: #fafafa; border: 1px solid #eee; margin: 2em; padding: .6em;"> -'.$body.' -</div> -</body> -</html>'; + $config = \SimpleSAML\Configuration::getInstance(); + $t = new \SimpleSAML\XHTML\Template($config, 'errorreport_mail.twig'); + $twig = $t->getTwig(); + return $twig->render('errorreport_mail.twig', ['body' => $body]); } diff --git a/templates/errorreport_mail.twig b/templates/errorreport_mail.twig new file mode 100644 index 0000000000000000000000000000000000000000..e549912e288fa470373706a9f9bab25023d490a9 --- /dev/null +++ b/templates/errorreport_mail.twig @@ -0,0 +1,30 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <meta http-equiv="content-type" content="text/html; charset=utf-8" /> + <title>SimpleSAMLphp Email report</title> + <style type="text/css"> +pre, div.box { + margin: .4em 2em .4em 1em; + padding: 4px; + +} +pre { + background: #eee; + border: 1px solid #aaa; +} +div.container { + background: #fafafa; + border: 1px solid #eee; + margin: 2em; + padding: .6em; +} + </style> +</head> +<body> +<div class="container"> +{{ body }} +</div> +</body> +</html>