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 = "[email protected]";
$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.';
}
?>
For PHPMailer to be able to send emails from your PHP app, you will need to connect it to an SMTP server. We suggest you first use an email testing tool such as Mailtrap Email Sandbox and its SMTP server to test the functionality before sending anything to real recipients.
The PHPMailer library provides the easiest way to send an email from localhost with an SMTP server using PHP. Not only the text email, but you can also send HTML email from localhost in PHP using PHPMailer.
But SPEWS can be worse than annoying: thanks to a security vulnerability in a popular web software component called PHPMailer, crooks could use your “contact us” form to take over your whole website. 24/7 threat hunting, detection, and response delivered by an expert team as a fully-managed service.
You dont need to =
in this
$mail->AddCC($email_1);
Try with this additional parameter
$mail->AddCC('[email protected]', 'Person One');
$mail->AddCC('[email protected]', 'Person Two');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With