Phpmailer AddBcc 不工作

2022-08-30 19:27:58

我正在使用phpmailer发送电子邮件,并且它的工作原理是收件人收到邮件,除了密件抄送和抄送详细信息未显示邮件。有人可以建议解决这个问题。代码是

require_once("PHPMailer_v5.1/class.phpmailer.php");
require_once("PHPMailer_v5.1/language/phpmailer.lang-en.php");              
$mailer = new PHPMailer();
$mailer->IsSMTP();              
$mailer->SMTPAuth = true;                   
$mailer->SMTPSecure = "tls";
$mailer->Host = 'smtp.gmail.com';
$mailer->Port = 587;                
$mailer->Username = "myuserid";
$mailer->Password = "mypassword";
$mailer->FromName = $fromname;
$mailer->From = "myuserid";             
$mailer->AddAddress("to@gmail.com",$toname);                
$mailer->Subject = $subject;                
$mailer->Body =$content;                
$mailer->AddCC("something@gmail.com", "bla");               
$mailer->AddBCC("foo@gmail.com", "test");
if(!$mailer->Send())
{
echo "Message was not sent";
}
else
echo "mail sent";

答案 1

用作

$mailer->AddBCC("foo@gmail.com", "test");
$mailer->AddCC("something@gmail.com", "bla");

答案 2

您永远不会看到密件抄送详细信息。这就是BCC详细信息。即使是BCC的收件人也不会看到他自己的名字与收件人。

PS:你注意到你写的而不是(大写的)?addBCCAddBCCA


推荐