PHP在邮件函数中插入抄送

发布于 2024-12-29 16:57:16 字数 673 浏览 0 评论 0原文

可能的重复:
PHP 邮件、抄送字段

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

谢谢

$headers = "From: $from_email\r\nReply-To: $from_email";

$headers .= "Return-Path: <[email protected]>";

//add boundary string and mime type specification
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";

Possible Duplicate:
PHP Mail, CC Field

I am using the following php to send an email. I need to add cc to my email. When I try to insert into header the html message show the raw html. What is the best way to handle a cc?

Thanks

$headers = "From: $from_email\r\nReply-To: $from_email";

$headers .= "Return-Path: <[email protected]>";

//add boundary string and mime type specification
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

陪你搞怪i 2025-01-05 16:57:16

刚刚对此进行了测试,它按预期工作:

$headers .= 'Cc: [email protected]\r\n';
$headers .= 'Bcc: [email protected]\r\n';

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

$headers = "From: $from_email\r\nReply-To: $from_email";
$headers .= 'Cc: [email protected]\r\n';
$headers .= 'Bcc: [email protected]\r\n';
$headers .= "Return-Path: <[email protected]>\r\n";

// add boundary string and mime type specification
$headers .= "Content-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";

希望有帮助

just tested this, and it worked as expected:

$headers .= 'Cc: [email protected]\r\n';
$headers .= 'Bcc: [email protected]\r\n';

I would also suggest moving your carriage return and new line to the end of the previous entry to $headers

$headers = "From: $from_email\r\nReply-To: $from_email";
$headers .= 'Cc: [email protected]\r\n';
$headers .= 'Bcc: [email protected]\r\n';
$headers .= "Return-Path: <[email protected]>\r\n";

// add boundary string and mime type specification
$headers .= "Content-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";

hope that helps

心房敞 2025-01-05 16:57:16

尝试添加

$headers .= 'CC: [email protected]' . "\r\n";

Try adding

$headers .= 'CC: [email protected]' . "\r\n";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文