Phpmailer添加密件抄送不起作用

时间:2012-09-21 04:57:53

标签: php phpmailer

我正在使用Phpmailer发送邮件。除了bcc之外,它的工作正常。密件抄送收件人看不到cc和to。为什么会这样?

require_once("PHPMailer_v5.1/class.phpmailer.php");
            $mailer = new PHPMailer();
            $mailer->IsSMTP();

            $mailer->SMTPAuth = true;
            $mailer->SMTPSecure = "tls";

            $mailer->Host = 'smtp.gmail.com';
            $mailer->Port = 587;            

            $mailer->Username = $userid;
            $mailer->Password = $epwd;
            $mailer->FromName = $fromname;
            $mailer->From = $userid;
            $mailer->AddAddress($to,$toname);
            $mailer->Subject = $subject;                
            $mailer->Body =$content;                
            $mailer->AddCC($cc, $tocc);             
            $mailer->AddBCC($bcc, $tobcc);          
            $mailer->AddAttachment($dest_filename);
            $mailer->Send()

2 个答案:

答案 0 :(得分:0)

这很有可能是gmail问题。 您是否使用其他SMTP服务提供商进行测试?

答案 1 :(得分:0)

来自class.phpmailer.php:

/**
  * Adds a "Bcc" address. Note: this function works<br>
  * with the SMTP mailer on win32, not with the "mail"<br>
  ...
 */
function AddBCC($address, $name = '') {
  ...
}