Hello

I am new to DaniWeb so please be gentle! I am also extremely new to PHP. Other than a couple of introduction classes I have not had much exposure...I am really trying though. Never the less, I have a web client that wants to be able to have his email address BCC to him so that the managers of his restaurants do not know that he receives the emails as well. When I took over these sites, the PHP script was already written. I have added what I thought it would take to receive BCC'ed email. I tested it with my email address and never received the email. Could someone please look over the following code and clue me in?

I have bolded and underlined the code that I have included.

Thank You!!!

<?
if (isset($_REQUEST["email"]))
{
    $dest = "user1@example.com, [email]user2@example.com[/email],  [email]user3@example.com[/email], [email]user4@example.com[/email], [email]user5@example.com[/email] ";
    [B][U]$headers = "Bcc: [email]bccrecipient@example.com[/email]";[/U][/B]

    $subject = "Meridian Restaurant & Bar Contact Form";

    $msgbody = "Meridian Restaurant & Bar Contact Form\r\n\r\n";

    $msgbody .= "Name: ".$_REQUEST["name"]."\r\n";
    $msgbody .= "Email: ".$_REQUEST["email"]."\r\n";
    $msgbody .= "\r\n\r\n";
    $msgbody .= "Comments:\r\n\r\n".$_REQUEST["comments"]."\r\n";
    $msgbody = stripslashes($msgbody);

mail($dest,$subject,$msgbody,[B][U]$headers[/U][/B], "From: ".$_REQUEST["name"]." <".$_REQUEST["email"].">\r\nReply-to: ".$_REQUEST["email"]."\r\n");
header("location:thanks.htm");
}
?> 

The parts I have added are highlighted:

Here's the code i have for a form emailer. Maybe you can use it for your purpose. Or at least compare with yours to see what the problem is. This code works perfectly well on my site.

Maybe it's the @ sign missing in front of mail? Or if worst comes to worst, you can do separate mail lines for each address.

$email_to1 = "address1";
$email_to2 = "address2";
$email_subject = "email subject line";

$email_message .= "First Name: ".clean_string($firstName)."\n";
$email_message .= "Last Name: ".clean_string($lastName)."\n";
$email_message .= "Email: ".clean_string($emailFrom)."\n";
$email_message .= "Telephone: ".clean_string($telephone)."\n";

$headers = 'From: '.$emailFrom."\r\n".
	'Reply-To: '.$emailFrom."\r\n" .
	'X-Mailer: PHP/' . phpversion();
	@mail($email_to1, $email_subject, $email_message, $headers);
	@mail($email_to2, $email_subject, $email_message, $headers);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.