[英]PHP Form - BCC not receiving emails
我正在尝试以我的PHP形式发送电子邮件。 出于某种原因,以下代码不会将表单发送到BCC地址:
$headers = "From: " . strip_tags($from) . "\r\n" . "BCC:test@test.com";
$headers .= "Reply-To: ". strip_tags($from) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
除了BCC没有收到电子邮件外,表格也有效。 对于BCC部分,我使用了接受的答案: 将BCC字段添加到php联系表单
任何帮助表示赞赏。
您的BCC不是由\\r\\n
分隔,因此reply-to标头将加入BCC值(使其无效)。
邮件服务器将BCC标头视为:
BCC:test@test.comReply-to: xxx@example.com
改成:
$headers = "From: " . strip_tags($from) . "\r\n" . "BCC:test@test.com\r\n";
附注: strip_tags()
不足以防止标头注入攻击。 您必须正确验证来自电子邮件地址。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.