PHP Mail, CC Field

In PHP, the "CC" field can be included in an email using the "mail" function by adding a "CC" header to the additional headers parameter. The format for the CC header should be "CC: email1, email2, email3" where "email1, email2, email3" are the email addresses of the recipients you want to CC.



$to = "[email protected]";
$subject = "Test email";
$message = "This is a test email.";
$headers = "From: [email protected]\r\n";
$headers .= "CC: [email protected], [email protected]\r\n";

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

In this example, "[email protected]" and "[email protected]" will receive a copy of the email.