I am using phpmailer to sent email, and it works the recipients receive the mail except the bcc and cc details is not showing the mail. Someone can suggest a solution to this . the code is
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";
Use as
$mailer->AddBCC("foo@gmail.com", "test");
$mailer->AddCC("something@gmail.com", "bla");
You never see BCC details. That's what they are BCC details for. Even the recipient of a BCC will not see his own name with the recipients.
PS: You noticed you wrote addBCC
instead of AddBCC
(capital A
)?
From the phpMailer function reference:
Adds a "Bcc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
This might be causing your issue.
PHPMailer not sending CC or BCC
Old question, but I ended up here looking for an answer. Just learned elsewhere that those functions AddCC and AddBCC only work with win32 SMTP
Try using:
$mail->addCustomHeader("BCC: mybccaddress@mydomain.com"); See http://phpmailer.worxware.com/?pg=methods
Hope this helps someone, cheers!
the bcc will never show; only TO and CC
BCC=Blind Carbon Copy
It´s addBCC
$email->addBCC('my@email.com', 'My Name');
See PHPMailer.php (current version 6.0.5) on line 934 (https://github.com/PHPMailer/PHPMailer/blob/master/src/PHPMailer.php#L934):
/**
* Add a "BCC" address.
*
* @param string $address The email address to send to
* @param string $name
*
* @return bool true on success, false if address already used or invalid in some way
*/
public function addBCC($address, $name = '')
{
return $this->addOrEnqueueAnAddress('bcc', $address, $name);
}
To operate the clausla BCC AddCC MUST precede as well nuloy hidden email will arrive to your recipient would otherwise happen nuna Example:
$ mail-> AddCC ("");
$ mail-> AddBCC ("mail @ domain")
来源:https://stackoverflow.com/questions/12777862/phpmailer-addbcc-not-working