【发布时间】:2015-06-13 19:42:17
【问题描述】:
我正在尝试让我们的 Wordpress 网站中的自定义联系表单在将填写好的表单发送给收件人时向我发送密件抄送。表单的 $headers 部分如下所示:
$headers = 'Content-type: text/html; charset=iso-8859-1'."\r\n";
$headers .= 'From: '.$email;
我已经尝试使用这个来实现密件抄送:
$headers = 'Content-type: text/html; charset=iso-8859-1'."\r\n";
$headers .= 'From: '.$email;
$headers .= 'Bcc: '.myemail@email.com;
...但它只发送给标准收件人,而不是密件抄送地址。
你能看出我做错了吗?非常感谢!
【问题讨论】:
-
这种方法非常脆弱——您没有应用这些标头所需的任何编码,因此很可能会因某些用户输入而中断。这就是为什么像 PHPMailer(Wordpress 使用)这样的库存在的原因,但是你绕过了所有这些。
-
我最终使用的是:
$headers = "From: .get_bloginfo('name').' <'.get_option('admin_email').'>'.\r\nReply-to: $email\r\nBcc: myemail@email.com";
标签: wordpress email phpmailer bcc