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 = '
EMUAS Flying Booking for ' . $this->rank . ' ' . $this->first_name . ' ' . $this->last_name . '
Start Date:
' . $this->flying_start_date . '
End Date:
' . $this->flying_end_date . '
Comments:
' . $this->flying_comments . '
'
$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
No comments:
Post a Comment