HTML confirmation email
Posted: Tue Jun 10, 2008 11:44 am
Hi,
I have been struggling for a while to figure out how to send a simple HTML confirmation mail with our company logo attached at the head and a short, thanks for booking etc. message in the body and a signature at the foot.
the url to the form is http://www.XXXXXX.co.uk/prototype/reservation.html
real URL removed by moderator for security reasons. See your PM here.
Currently the form is working fine but only sends text email confirmations. I am predominantly a web designer that inherited the project, I managed to get it working up to this point, but have been stumped on how to get the response confirmation mail to send in HTML.
Any help would be appreciated, the code is attached.
Kind Regards,
Frank
the code follow:
<?php
<!--- Needed for fasthosts -------->
ini_set("sendmail_from", "email@somedomain.com");
// Receiving variables
@$title = addslashes($_POST['title']);
@$username = addslashes($_POST['username']);
@$surname = addslashes($_POST['surname']);
@$email = addslashes($_POST['email']);
@$phone = addslashes($_POST['phone']);
@$postcode = addslashes($_POST['postcode']);
@$guests = addslashes($_POST['guests']);
@$dateinput = addslashes($_POST['dateinput']);
@$time = addslashes($_POST['time']);
@$enquiry = addslashes($_POST['enquiry']);
//Sending Email to form owner
$pfw_header = "From: $email\n"
. "Reply-To: $email\n";
$pfw_subject = "Tapa Tapa booking Enquiry";
$pfw_email_to = "eamil@email.com";
$pfw_message = "Title: $title\n"
. "First Name: $username\n"
. "Surname: $surname\n"
. "email: $email\n"
. "Phone Number: $phone\n"
. "Postcode: $postcode\n"
. "Number of guests: $guests\n"
. "Date: $dateinput\n"
. "Time: $time\n"
. "Additional enquiry: $enquiry\n";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
//Sending auto respond Email to visitor
$pfw_header = "From: eamil@email.com\n"
. "Reply-To: o2@tapatapa.com\n";
$pfw_subject = "Your Tapa Tapa booking enquiry received";
$pfw_email_to = "$email";
$pfw_message = "Dear $username,\n"
. "\n"
. "Thank you for your booking enquiry, please note this is not a confirmed reservation we shall be in touch to confirm shortly.\n"
. "\n"
. "Kind Regards,\n"
. "The Tapa Tapa Team";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
//saving record in a text file
$pfw_file_name = "velvetcard.csv";
$pfw_first_raw = "title,username,surname,email,phone,postcode,guests,dateinput,time,enquiry\r\n";
$pfw_values = "$title,$username,$surname,$email,$phone,$postcode,$guests,$dateinput,$time,$enquiry\r\n";
$pfw_is_first_row = false;
if(!file_exists($pfw_file_name))
{
$pfw_is_first_row = true ;
}
if (!$pfw_handle = fopen($pfw_file_name, 'a+')) {
die("Cannot open file ($pfw_file_name)");
exit;
}
if ($pfw_is_first_row)
{
if (fwrite($pfw_handle, $pfw_first_raw ) === FALSE) {
die("Cannot write to file ($pfw_filename)");
exit;
}
}
if (fwrite($pfw_handle, $pfw_values) === FALSE) {
die("Cannot write to file ($pfw_filename)");
exit;
}
fclose($pfw_handle);
$confirmation = true;
header('Location: reservation.html?confirmation');
?>
I have been struggling for a while to figure out how to send a simple HTML confirmation mail with our company logo attached at the head and a short, thanks for booking etc. message in the body and a signature at the foot.
the url to the form is http://www.XXXXXX.co.uk/prototype/reservation.html
real URL removed by moderator for security reasons. See your PM here.
Currently the form is working fine but only sends text email confirmations. I am predominantly a web designer that inherited the project, I managed to get it working up to this point, but have been stumped on how to get the response confirmation mail to send in HTML.
Any help would be appreciated, the code is attached.
Kind Regards,
Frank
the code follow:
<?php
<!--- Needed for fasthosts -------->
ini_set("sendmail_from", "email@somedomain.com");
// Receiving variables
@$title = addslashes($_POST['title']);
@$username = addslashes($_POST['username']);
@$surname = addslashes($_POST['surname']);
@$email = addslashes($_POST['email']);
@$phone = addslashes($_POST['phone']);
@$postcode = addslashes($_POST['postcode']);
@$guests = addslashes($_POST['guests']);
@$dateinput = addslashes($_POST['dateinput']);
@$time = addslashes($_POST['time']);
@$enquiry = addslashes($_POST['enquiry']);
//Sending Email to form owner
$pfw_header = "From: $email\n"
. "Reply-To: $email\n";
$pfw_subject = "Tapa Tapa booking Enquiry";
$pfw_email_to = "eamil@email.com";
$pfw_message = "Title: $title\n"
. "First Name: $username\n"
. "Surname: $surname\n"
. "email: $email\n"
. "Phone Number: $phone\n"
. "Postcode: $postcode\n"
. "Number of guests: $guests\n"
. "Date: $dateinput\n"
. "Time: $time\n"
. "Additional enquiry: $enquiry\n";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
//Sending auto respond Email to visitor
$pfw_header = "From: eamil@email.com\n"
. "Reply-To: o2@tapatapa.com\n";
$pfw_subject = "Your Tapa Tapa booking enquiry received";
$pfw_email_to = "$email";
$pfw_message = "Dear $username,\n"
. "\n"
. "Thank you for your booking enquiry, please note this is not a confirmed reservation we shall be in touch to confirm shortly.\n"
. "\n"
. "Kind Regards,\n"
. "The Tapa Tapa Team";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
//saving record in a text file
$pfw_file_name = "velvetcard.csv";
$pfw_first_raw = "title,username,surname,email,phone,postcode,guests,dateinput,time,enquiry\r\n";
$pfw_values = "$title,$username,$surname,$email,$phone,$postcode,$guests,$dateinput,$time,$enquiry\r\n";
$pfw_is_first_row = false;
if(!file_exists($pfw_file_name))
{
$pfw_is_first_row = true ;
}
if (!$pfw_handle = fopen($pfw_file_name, 'a+')) {
die("Cannot open file ($pfw_file_name)");
exit;
}
if ($pfw_is_first_row)
{
if (fwrite($pfw_handle, $pfw_first_raw ) === FALSE) {
die("Cannot write to file ($pfw_filename)");
exit;
}
}
if (fwrite($pfw_handle, $pfw_values) === FALSE) {
die("Cannot write to file ($pfw_filename)");
exit;
}
fclose($pfw_handle);
$confirmation = true;
header('Location: reservation.html?confirmation');
?>