php邮件功能:仅将邮件发送到密件抄送 [英] php mail function: Sending mails to BCC only
本文介绍了php邮件功能:仅将邮件发送到密件抄送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
php邮件功能的第一个参数是TO.无论如何,是否可以跳过此参数并仅使用CC/BCC发送批量邮件?
谢谢
解决方案
您可以为此指定第四个标头参数:
$xheaders = "";
$xheaders .= "From: <$from>\n";
$xheaders .= "X-Sender: <$from>\n";
$xheaders .= "X-Mailer: PHP\n"; // mailer
$xheaders .= "X-Priority: 1\n"; //1 Urgent Message, 3 Normal
$xheaders .= "Content-Type:text/html; charset=\"iso-8859-1\"\n";
$xheaders .= "Bcc:email@example.com"\n";
$xheaders .= "Cc:email2@example.com\n";
//.......
mail($to, $subject, $msg, $xheaders);
在$to
字段中,您可以指定电子邮件或您喜欢的任何内容.
注意 ,尽管我不确定可以用这种方式指定的电子邮件的确切数量,但是您也可以用逗号分隔多个电子邮件地址.>
the first param of php mail function is TO. Is there anyway to skip this parameter and use only CC/BCC to send bulk mails?
Thanks
解决方案
You can specify fourth headers parameter for that like this:
$xheaders = "";
$xheaders .= "From: <$from>\n";
$xheaders .= "X-Sender: <$from>\n";
$xheaders .= "X-Mailer: PHP\n"; // mailer
$xheaders .= "X-Priority: 1\n"; //1 Urgent Message, 3 Normal
$xheaders .= "Content-Type:text/html; charset=\"iso-8859-1\"\n";
$xheaders .= "Bcc:email@example.com"\n";
$xheaders .= "Cc:email2@example.com\n";
//.......
mail($to, $subject, $msg, $xheaders);
In the $to
field you can specify your email or whatever you like.
Note that you can also specify multiple email addresses by separating them with a comma although I am not sure about exact number of email you can specify this way.
这篇关于php邮件功能:仅将邮件发送到密件抄送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文