Please could somebody help. I need my form to send an email to a BCC email address. Here's my current code. It works well, but without the BCC function.
Code: Select all
<?php
// get posted data into local variables
$EmailFrom = "Enquiry";
$EmailTo = "robin@trillodigital.co.uk";
$Subject = "Maria Watt Foundation website enquiry";
$name = Trim(stripslashes($_POST['name']));
$email = Trim(stripslashes($_POST['email']));
$telephone = Trim(stripslashes($_POST['telephone']));
$comments = Trim(stripslashes($_POST['comments']));
// validation
if (strtolower($_POST['code']) != 'mwf') {die('Sorry, you have entered the wrong code. This measure is in place to prevent spam via this website. Please go back and enter the correct code.');}
$validationOK=true;
if (Trim($email)=="") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.mariawattfoundation.org/error.html\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $name;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $email;
$Body .= "\n";
$Body .= "Telephone: ";
$Body .= $telephone;
$Body .= "\n";
$Body .= "Comments: ";
$Body .= $comments;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.mariawattfoundation.org/thankyou.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.mariawattfoundation.org/error.html\">";
}
?>