-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsendEmail.php
35 lines (29 loc) · 936 Bytes
/
sendEmail.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
$headers = "";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$bccList = "stephen@rowantree.org, morwen@earthdrum.com";
$headers .= "Bcc: $bccList\r\n";
$headers .= "From: EDC Registration <stephen@rowantree.org>\r\n";
$msg = "<html>";
$msg .= "<table border=1>";
foreach( $data as $key => $value )
{
$msg .= "<tr><th>$key</th><td>$value</td></tr>";
}
$msg .= "</table>";
$msg .= "</html>";
$emailAddr = "$data[firstName] $data[lastName] <$data[email]>";
$subject = "$data[eventCode] Registration for $data[firstName] $data[lastName] #$data[regNbr]";
if (!@mail( $emailAddr, $subject, $msg, $headers ) )
{
$error = error_get_last();
foreach( $error as $key => $value )
{
echo "[$key] $value<br>";
}
error_log("Failed to send email to $emailAddr", 3, 'error.log');
echo "<br>eMail notice to $emailAddr could not be sent";
}
echo $msg;
?>