PHP邮件添加密件抄送 [英] PHP Mail adding BCC

查看:119
本文介绍了PHP邮件添加密件抄送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个填写要发送给我们客户的PHP邮件的表格,由于隐私原因,我想对大多数客户进行密件抄送.我有以下代码

I have a form that populates a PHP mail to be sent to our clients, I want to BCC most of the clients due to privacy. I have the following code

$to = "******@e-track.co.za"; //To recipients 
$email_from = '*****@etrackbureau.co.za';//<== update the email address
$email_subject = "New Overdue Loaded";
$email_body = "A new High Risk Client has been loaded by $name $company.\n".
    "\n Client Name: $driver_name $driver_surname\n
    \n Client ID or Passport Number: $driver_id\n
    \n Nationality: $driver_nationality\n
    \n Reason for Loading Client: $type\n
    \n Notes: $notes\n
    ".
$headers = "From: $email_from \r\n";
$headers = "Bcc: ******@e-track.co.za;*****@e-track.co.za;******@e-track.co.za\r\n";
//$headers = "Reply-To: $visitor_email \r\n";
//Send the email!
mail($to,$email_subject,$email_body,$headers);

我已将密件抄送添加为$ headers,但是一旦添加,我将其发送到$ to收件人时根本不发送邮件.

I have added the BCC as a $headers but once I add this it doesn't send mails at all when I remove it I get the mail to the $to recipient.

我也尝试了密件抄送邮件之间的间隔.由于垃圾邮件的原因,我用****替换了邮件名

I have tried spacing between the BCC mails as well. I have replaced the mail names with **** for spamming reasons

推荐答案

您应该连接$headers

示例:

$headers  = "From: *****@etrackbureau.co.za\r\nX-Mailer: php\r\n";
$headers .= "MIME-Version: 1.0\r\n"; #Define MIME Version
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; #Set content type
$headers .= "Bcc: $EmailListHere\r\n"; #Your BCC Mail List

这篇关于PHP邮件添加密件抄送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆