Zephyr2
02-05-2010, 05:46 AM
Need help adding CC to email.
I have a very limited knowledge of PHP programing and am attempting yo modify a script for sending an email form from my website. It works fine, but I need it to send a CC or second email to a different address.
Here is the script:
<?php
$EmailTo = "myaddress@comcast.net";
$Where = Trim(stripslashes($_POST['where']));
$Subject = "Free Initial Consultation Request Form";
$Tel = Trim(stripslashes($_POST['Tel']));
$Name = Trim(stripslashes($_POST['Name']));
$Email = Trim(stripslashes($_POST['Email']));
$msg = Trim(stripslashes($_POST['Message']));
$human = $_REQUEST['url'];
$headers = "From: <$Email>\r\n";
$headers .= "Reply-To: <$Email>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$Body = '<html><body>';
$Body .= '<h1>Consultation Request Form</h1>';
$Body .= '<table rules="all" style="border-color: #666;" cellpadding="10">';
$Body .= "<tr style='background: #eee;'><td><strong>Name:</strong> </td><td>$Name</td></tr>";
$Body .= "<tr><td><strong>Email:</strong> </td><td>$Email</td></tr>";
$Body .= "<tr><td><strong>Telephone:</strong> </td><td>$Tel</td></tr>";
$Body .= "<tr><td><strong>Message:</strong> </td><td>$msg</td></tr>";
$Body .= "</table>";
$Body .= '</body></html>';
if ($human != "") {print "Apparently you are not human";}
else {
if($Name == '') {print "You have not entered a name, please go back and try again";}
else {
if($Email == '') {print "You have not entered an email, please go back and try again";}
else {
if($Tel == '') {print "You have not entered a telephone number, please go back and try again";}
else {
$success = mail($EmailTo, $Subject, $Body, $headers);
}
}
}
}
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.html\">";
}
?>
I tried adding a cc to the header
with this coding:
$headers .= "Cc: someone@domain.com \r\n";
But it did not work.
Any help you can give will be appreciated.
Thanks
I have a very limited knowledge of PHP programing and am attempting yo modify a script for sending an email form from my website. It works fine, but I need it to send a CC or second email to a different address.
Here is the script:
<?php
$EmailTo = "myaddress@comcast.net";
$Where = Trim(stripslashes($_POST['where']));
$Subject = "Free Initial Consultation Request Form";
$Tel = Trim(stripslashes($_POST['Tel']));
$Name = Trim(stripslashes($_POST['Name']));
$Email = Trim(stripslashes($_POST['Email']));
$msg = Trim(stripslashes($_POST['Message']));
$human = $_REQUEST['url'];
$headers = "From: <$Email>\r\n";
$headers .= "Reply-To: <$Email>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$Body = '<html><body>';
$Body .= '<h1>Consultation Request Form</h1>';
$Body .= '<table rules="all" style="border-color: #666;" cellpadding="10">';
$Body .= "<tr style='background: #eee;'><td><strong>Name:</strong> </td><td>$Name</td></tr>";
$Body .= "<tr><td><strong>Email:</strong> </td><td>$Email</td></tr>";
$Body .= "<tr><td><strong>Telephone:</strong> </td><td>$Tel</td></tr>";
$Body .= "<tr><td><strong>Message:</strong> </td><td>$msg</td></tr>";
$Body .= "</table>";
$Body .= '</body></html>';
if ($human != "") {print "Apparently you are not human";}
else {
if($Name == '') {print "You have not entered a name, please go back and try again";}
else {
if($Email == '') {print "You have not entered an email, please go back and try again";}
else {
if($Tel == '') {print "You have not entered a telephone number, please go back and try again";}
else {
$success = mail($EmailTo, $Subject, $Body, $headers);
}
}
}
}
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.html\">";
}
?>
I tried adding a cc to the header
with this coding:
$headers .= "Cc: someone@domain.com \r\n";
But it did not work.
Any help you can give will be appreciated.
Thanks