PHP Mail script and using BCC

Hi There

I’m having some trouble with the php mail script I have put together. An email does get sent when the form is submitted, but only to teh first BCC recipitant. The email in the ‘To’ field doesn’t receive an email nor the other to BCC email address. I have obviously chnaged the email address for the purpose of this post - the ones I have listed are genuine accounts. I need my email script to send to 3 different email address. Can anyone shed some light? many thanks

<?
$name = $_POST[“name”];
$email = $_POST[“email”];
$contact = $_POST[“contact”];
$query = $_POST[“query”];
$hear_about_us = $_POST[“hear_about_us”];
$fromName = “Enquiry Form”;

$to = “myEmail@hotmail.com”;
$subject = “Enquiry submitted”;
$message = "An enquiry has been submitted via the website.\

Here are the details:\

Name: $name\

Email Address: $email\

Tel Number: $contact\

Query : $query \

How did you hear about us: $hear_about_us";

$from = “form_submit@myDomain.com”;
$headers = "From: $name\r
";
$headers .= "BCC: info@mytestdomain.com
";
$headers .= "Bcc: anotherEmailAccount@hotmail.com
";
$headers .= "Bcc: anotherEmailAccount@yahoo.com
";

mail($to,$subject,$message,$headers);
?>

$headers .= "bcc: info@mytestdomain.com, anotherEmailAccount@hotmail.com, anotherEmailAccount@yahoo.com
";


<?php

$to = "nobody@nowhere.yy";

$user_list = array("nobody@nowhere.xy", "nobody@nowhere.yz");

$list = implode(",", $user_list);

$subject = "subject";
$message = "hello! this is a test message!";
$headers = "From: webmaster@localhost.localdomain\\r\
" .
    "Reply-To: webmaster@localhost.localdomain\\r\
" .
    "Bcc: $list\\r\
";
    "X-Mailer: PHP/" . phpversion();

mail($to, $subject, $message, $headers);

Hi Guys & thanks for your help so far on this.

I still have the same issue with my php form-to-mail code. When the form is submitted the code below does send an email to my address info@mydomain.com, however it doesn’t send to any of the email addresses on my client’s domain i.e. info@clientsdomain.co.uk This poses a problem as the website sits on my clients hosting and at the moment they can’t receive emails from the form-to-mail. I told my client to take off any filters they may have on their mail system, which might prevent emails being delivered from a auto form mailer - but still the mails don’t arrive, however they do send to my email address everytime with no problems, which is not on their domain.

    $name = $_POST["name"];
    $email = $_POST["email"];
    $contact = $_POST["contact"];
    $query = $_POST["query"];
    $hear_about_us = $_POST["hear_about_us"];
    $to = "info@clientsdomain.co.uk";
    $user_list = array("info@clientsdomain.co.uk","info@mydomain.com");
    $list = implode(",", $user_list);
    $subject = "Enquiry submitted via website";
    $message = "An enquiry has been submitted via the website.\

    Here are the details:\

    Name: $name\

    Email Address: $email\

    Tel Number: $contact\

    Query : $query \

    How did you hear about us: $hear_about_us";
    $headers = "From: [email]WebEnquiry@clientsdomain.co.uk[/email]\\r\

" .
"Reply-To: info@clientsdomain.co.uk \r
" .
"Bcc: $list\r
";
“X-Mailer: PHP/” . phpversion();
mail($to, $subject, $message, $headers);

Can anyone think of a reason why this might be the case? Does anyone have a form to mail example that has worked every time for them on different hostings? Anything noticeably wrong with my code above?

Many thanks in advance

i theink your mail client treat as a spam and automatically deletes it. Since it is working for other domain. Have you tried for any other email too?

yes I tried with 2 different email accounts and it worked fine. However I just tried with a hotmail account and it didn’t work as well, which is odd. It definately doesn’t work for any of my clients email accounts i.e info@myclients.com or john@myclients.co.uk, etc, etc.