Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phpmailer AddBcc not working

Tags:

php

phpmailer

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("[email protected]",$toname);                
$mailer->Subject = $subject;                
$mailer->Body =$content;                
$mailer->AddCC("[email protected]", "bla");               
$mailer->AddBCC("[email protected]", "test");
if(!$mailer->Send())
{
echo "Message was not sent";
}
else
echo "mail sent";
like image 441
Vidya L Avatar asked Oct 08 '12 08:10

Vidya L


People also ask

How many examples of PHPMailer addbcc are there?

PHP PHPMailer::addBCC - 30 examples found. These are the top rated real world PHP examples of PHPMailer::addBCC extracted from open source projects. You can rate examples to help us improve the quality of examples.

Are there any real world PHP examples of PHPMailer?

These are the top rated real world PHP examples of PHPMailer::addBCC extracted from open source projects. You can rate examples to help us improve the quality of examples.

How do I set mail_cc?

The setting is $mail->AddCC (MAIL_CC); define ('MAIL_CC', ' [email protected] '); Sorry, something went wrong. @madhukaleeckal In the code snippet you posted you are only defining MAIL_CC after you are using it!?


3 Answers

Use as

$mailer->AddBCC("[email protected]", "test");
$mailer->AddCC("[email protected]", "bla");
like image 156
Soojoo Avatar answered Oct 18 '22 20:10

Soojoo


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)?

like image 45
GolezTrol Avatar answered Oct 18 '22 19:10

GolezTrol


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.

like image 40
panepeter Avatar answered Oct 18 '22 18:10

panepeter