how to cc email in php?
Posted: Mon Feb 05, 2007 7:01 am
feyd | Please use
Can anyone help?
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I'm a novice in php and would appreciate any help and advice anyone can give me. I have an email form that does email the results back to me fine. However, I would also like to email or cc the results back to the person making the enquiry to confirm that their enquiry has been received. Here is the code:Code: Select all
<?php
$EmailFrom = Trim(stripslashes($_POST['EmailFrom']));
$EmailTo = "paul.mccann@firstfound.co.uk";
$Subject = "Photocopier Enquiry";
$ColourCopiers = Trim(stripslashes($_POST['ColourCopiers']));
$BlackandWhiteCopiers = Trim(stripslashes($_POST['BlackandWhiteCopiers']));
$Facsimilies = Trim(stripslashes($_POST['Facsimilies']));
$Purchase = Trim(stripslashes($_POST['Purchase']));
$Lease = Trim(stripslashes($_POST['Lease']));
$Name = Trim(stripslashes($_POST['Name']));
$Company = Trim(stripslashes($_POST['Company']));
$PostCode = Trim(stripslashes($_POST['PostCode']));
$Email = Trim(stripslashes($_POST['Email']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Message = Trim(stripslashes($_POST['Message']));
$Brochure = Trim(stripslashes($_POST['Brochure']));
$Model = Trim(stripslashes($_POST['Model']));
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
$Body = "";
$Body .= "ColourCopiers: ";
$Body .= $ColourCopiers;
$Body .= "\n";
$Body .= "BlackandWhiteCopiers: ";
$Body .= $BlackandWhiteCopiers;
$Body .= "\n";
$Body .= "Facsimilies: ";
$Body .= $Facsimilies;
$Body .= "\n";
$Body .= "Purchase: ";
$Body .= $Purchase;
$Body .= "\n";
$Body .= "Lease: ";
$Body .= $Lease;
$Body .= "\n";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Company: ";
$Body .= $Company;
$Body .= "\n";
$Body .= "PostCode: ";
$Body .= $PostCode;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
$Body .= "Brochure: ";
$Body .= $Brochure;
$Body .= "\n";
$Body .= "Model: ";
$Body .= $Model;
$Body .= "\n";
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=thanks.htm\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=contact.php\">";
}
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]