email - php mail() not sending Cc and Bcc
I have a php file which sends an email after a contact form has been submitted.
The email delivers correctly to the recipient, but it does never deliver to the Cc and Bcc. In the received email, anyways, the Cc is there(of course Bcc doesnt show up but if Cc is there Bcc should be too), but it just does not deliver to them.
Here is the code
<?php
$from = '[email protected]';
$to = $_POST['mail'];
$name = $_POST['nombre'];
$lastname = $_POST['apellido'];
$msg = "this is the content of the mail";
$subject = 'this is the subj';
$headers = "From:".$from."\r\n";
$headers .= "Cc:".$from.", [email protected],[email protected]\r\n";
$headers .= "BCC:[email protected]\r\n";
if ($name=="" || $lastname=="" || $_POST['mensaje']=="" || $to==""){
echo '0';
}else{
if(mail($to, $subject, $msg, $headers)){
echo '1';
}else{
echo '-1';
}
}
?>