PHP将cc插入到邮件函数中


PHP insert cc into mail function

可能重复:
PHP邮件,CC字段

我正在使用以下php发送电子邮件。我需要将抄送添加到我的电子邮件中。当我尝试将html消息插入标头时,它会显示原始html。处理抄送的最佳方式是什么?

感谢

$headers = "From: $from_email'r'nReply-To: $from_email";
$headers .= "Return-Path: <info@premierinspectiontn.com>";
//add boundary string and mime type specification
$headers .= "'r'nContent-Type: multipart/mixed; boundary='"PHP-mixed-".$random_hash."'"";

刚刚测试了这一点,它按预期工作:

$headers .= 'Cc: test@test.com'r'n';
$headers .= 'Bcc: test@test.com'r'n';

我还建议将您的车厢回程和新行移到$headers 上一个条目的末尾

$headers = "From: $from_email'r'nReply-To: $from_email";
$headers .= 'Cc: test@test.com'r'n';
$headers .= 'Bcc: test@test.com'r'n';
$headers .= "Return-Path: <info@premierinspectiontn.com>'r'n";
// add boundary string and mime type specification
$headers .= "Content-Type: multipart/mixed; boundary='"PHP-mixed-".$random_hash."'"";

希望对有所帮助

尝试添加

$headers .= 'CC: other@url.com' . "'r'n";