48 return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
49 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
50<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
52 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
53 <title>SimpleSAMLphp Email report</title>
54 <style type="text/css">
56 margin: .4em 2em .4em 1em;
62 border: 1px solid #aaa;
67<div class="container" style="background: #fafafa; border: 1px solid #eee; margin: 2em; padding: .6em;">
80 if ($this->to ===
null) {
81 throw new Exception(
'EMail field [to] is required and not set.');
82 } elseif ($this->subject ===
null) {
83 throw new Exception(
'EMail field [subject] is required and not set.');
84 } elseif ($this->body ===
null) {
85 throw new Exception(
'EMail field [body] is required and not set.');
88 $random_hash = bin2hex(openssl_random_pseudo_bytes(16));
90 if (isset($this->from)) {
93 if (isset($this->replyto)) {
97 $this->headers[] =
'Content-Type: multipart/alternative; boundary="simplesamlphp-' . $random_hash .
'"';
100--simplesamlphp-' . $random_hash .
'
101Content-Type: text/plain; charset="utf-8"
102Content-Transfer-Encoding: 8bit
104' . strip_tags(html_entity_decode($this->body)) .
'
106--simplesamlphp-' . $random_hash .
'
107Content-Type: text/html; charset="utf-8"
108Content-Transfer-Encoding: 8bit
110' . $this->
getHTML($this->body) .
'
112--simplesamlphp-' . $random_hash .
'--
114 $headers = implode(
"\n", $this->headers);
119 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)