I'm trying to create a booking system that when a user books and event it sends an e-mail to the required people, most of it works now but I'm having trouble with the e-mail system.
The e-mail only sends to the $to and not to the CC:. Also it is sent by the hosting server and does not show the FROM:. I've read a few pages which says the order of the headings are important, but I can't seem to find the right order.
Here is the code
$to = 'crnflying@gmail.com';
$subject = $this->rank . ' ' . $this->first_name . ' ' . $this->last_name;
$message = '
<html>
<body>
<img style="float: right;" src="http://www.emuas.co.uk/templates/emuas-public/images/emuas-title.png" alt="emuas-logo">
<h2>EMUAS Flying Booking for ' . $this->rank . ' ' . $this->first_name . ' ' . $this->last_name . '</h2>
<table style="border-color: #666;" cellpadding="10">
<tr>
<td><strong>Start Date:</strong> </td>
<td>' . $this->flying_start_date . '</td>
</tr>
<tr>
<td><strong>End Date:</strong> </td>
<td>' . $this->flying_end_date . '</td>
</tr>
<tr>
<td><strong>Comments:</strong> </td>
<td>' . $this->flying_comments . '</td>
</tr>
</table>
</body>
</html>'
$headers = 'MIME-Version: 1.0' . '\r\n';
$headers .= 'Content-type:text/html;charset=iso-8859-1' . '\r\n';
$headers .= 'From: <' . $this->email . '>' . '\r\n';
$headers .= 'Reply-To: ' . $this->email . '\r\n';
$headers .= 'CC: ' . $this->email . '\r\n';
if (mail($to, $subject, $message, $headers)) {
echo 'Your message has been sent.'; }
else {
echo 'There was a problem sending the email.';
}
Any help would be much appreciated. Byron