Skip to content
Advertisement

Add CC in PHP Mailer not working

Im trying to send on email to user using AddAddress and another three emails to admin and so on by CC .
I can send out email using AddAdress() But not using Add CC.
Below is my code.

<?php
require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->IsSMTP();  // telling the class to use SMTP
$mail->Host     = "mail.test.com.my"; // SMTP server

$mail->From     = "enquiry@test.com.my";
$mail->AddAddress($email);

$mail->Subject  = "Colourful email";
$mail->Body     =$message;
/*$mail->WordWrap = 50;*/
$mail->AddCC    =($email_1);
$mail->AddCC    =($email_2);
$mail->AddCC    =($email_3);

if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Kindly check your email for the confirmation of your rental.Thank you.';
}

?>

Advertisement

Answer

You dont need to = in this

$mail->AddCC($email_1);
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement