37 return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
38 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
39<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
41 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
42 <title>SimpleSAMLphp Email report</title>
43 <style type="text/css">
45 margin: .4em 2em .4em 1em;
51 border: 1px solid #aaa;
56<div class="container" style="background: #fafafa; border: 1px solid #eee; margin: 2em; padding: .6em;">
64 if ($this->to == NULL)
throw new Exception(
'EMail field [to] is required and not set.');
65 if ($this->subject == NULL)
throw new Exception(
'EMail field [subject] is required and not set.');
66 if ($this->body == NULL)
throw new Exception(
'EMail field [body] is required and not set.');
68 $random_hash = bin2hex(openssl_random_pseudo_bytes(16));
70 if (isset($this->from))
72 if (isset($this->replyto))
75 $this->headers[] =
'Content-Type: multipart/alternative; boundary="simplesamlphp-' . $random_hash .
'"';
78--simplesamlphp-' . $random_hash .
'
79Content-Type: text/plain; charset="utf-8"
80Content-Transfer-Encoding: 8bit
82' . strip_tags(html_entity_decode($this->body)) .
'
84--simplesamlphp-' . $random_hash .
'
85Content-Type: text/html; charset="utf-8"
86Content-Transfer-Encoding: 8bit
88' . $this->
getHTML($this->body) .
'
90--simplesamlphp-' . $random_hash .
'--
92 $headers = implode(
"\n", $this->headers);
96 if (!$mail_sent)
throw new Exception(
'Error when sending e-mail');
An exception for terminatinating execution or to throw for unit testing.
__construct($to, $subject, $from=NULL, $cc=NULL, $replyto=NULL)
Constructor.
catch(Exception $e) $message
mail($to, $subject, $message, $additional_headers=null, $additional_parameters=null)