email - php mail() not sending Cc and Bcc

922

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';
    }
}



?>

People are also looking for solutions to the problem: php - How to change a Symfony parameter

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.