密件抄送:使用自定义 Wordpress mail.php 联系表

Bcc: using custom Wordpress mail.php contact form

我正在尝试让我们的 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;

...但它只发送给标准收件人,而不是密件抄送地址。

你能看出我做错了什么吗?非常感谢!

试试$headers的数组形式-

$headers[] = 'Content-type: text/html; charset=iso-8859-1';
$headers[] = 'From: '.$email;
$headers[] = 'Bcc: myemail@email.com';