在PHP邮件功能中添加CC

时间:2016-03-22 10:22:30

标签: php header carbon-copy

我想用CC发送邮件。电子邮件已成功发送,但未发送CC。

$to = 'abc@xyz.com';
$subject = 'Order Details of Order Number:'.$orderID; 
$headers = "From: webmaster@xyz.com\r\nReply-To: webmaster@xyz.com";
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\""; 
$message = "Test Message";
$headers .= 'Cc: def@xyz.com' . "\r\n";
mail($to, $subject, $message, $headers);

我将此邮件发送为HTML。

2 个答案:

答案 0 :(得分:1)

添加标题如下,

outlineViewItemWillExpand(_:)

答案 1 :(得分:0)

尝试按以下顺序添加此代码:

$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."\"";

Resource