[英]Issue with Cc and Bcc in sending mails using SMTP - PHP
I'm sending email from my php page using SMTP. 我正在使用SMTP从PHP页面发送电子邮件。 everything works perfect except Bcc. 除“密件抄送”外,其他所有功能都完美无缺。
This is how I got my email, Interestingly I can see bcc as well. 这就是我收到电子邮件的方式,有趣的是,我也可以看到密件抄送。
Whats wrong in my code, can anyone please help. 我的代码有什么问题,任何人都可以帮忙。
$Headers = array("MIME-Version"=> '1.0',
"Content-type" => "text/html; charset=iso-8859-1",
"From" => $From,
"To" => $To,
"Bcc" => $User_copy,
"Reply-To" => $From,
"Subject" => $Subject);
$SMTP = Mail::factory('smtp', array ('host' => $Host, 'auth' => true, 'username' => $Username, 'password' => $Password));
$mail = $SMTP->send($To, $Headers, $Message);
Diagnose : 诊断 :
Your mail server does not strip Bcc: headers. 您的邮件服务器不会删除Bcc:标头。
Fix: 固定:
Do not specify bcc recipients in BCC:
headers. 不要在“ BCC:
标题中指定密件BCC:
收件人。
Add the bcc recipients to first parameter of send
. 将密件抄送收件人添加到send
第一个参数中。
http://pear.php.net/manual/en/package.mail.mail.send.php http://pear.php.net/manual/en/package.mail.mail.send.php
Try this. 尝试这个。
$To=(string)$SendToEmail ;
$bcc = "WEBMASTERS_EMAIL_ADDRESS";
$recipients = $To.",".$bcc;
$headers["From"] = "who@whatever";
$headers["To"] = $To;
$headers["Reply-To"] = $visitormail;
$headers["Subject"] = $subject;
$mailmsg = $message;
/* SMTP server name, port, user/passwd */
$smtpinfo["host"] = "YOURSITEMAILSERVER.whatever";
$smtpinfo["port"] = "25";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "Emailaddress@YOURSITEMAILSERVER.whatever";
$smtpinfo["password"] = EMAIL_PASSWORD";
/* Create the mail object using the Mail::factory method */
$mail_object =& Mail::factory("smtp", $smtpinfo);
/* Ok send mail */
$mail_object->send($recipients, $headers, $mailmsg);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.