-5

How can I add BCC to my contact form? I have tried a few different ways, but I am unsure why its not working. I know I need to add an @header with the bcc but no luck so far.

here is my PHP code; its originally from a CSStricks comment:

<?php

$EmailFrom = "myemails@emails.com";
$EmailTo = "myemails@emails.com";
$Subject = "Popes Enterprises Contact Form";
$Name = Trim(stripslashes($_POST['Name'])); 
$Tel = Trim(stripslashes($_POST['Tel'])); 
$Email = Trim(stripslashes($_POST['Email'])); 
$Message = Trim(stripslashes($_POST['Message'])); 

// validation
$validationOK=true;
if (!$validationOK) {
 print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
 exit;
}

// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "City: ";
$Body .= $City;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$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=contactthanks.php\">";
}
else{
 print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
Lawrence Cherone
  • 46,049
  • 7
  • 62
  • 106
LukeD1uk
  • 242
  • 2
  • 14

1 Answers1

0

I dont think you tried googling your question, but here is a link which will explain you how to use headers with the PHP mail function http://www.htmlite.com/php029.php

Meneer Venus
  • 1,039
  • 2
  • 12
  • 28