I am using phpmailer doing send multiple email address functions to recepients. Now my problem is, I cannot send all selected multiple addresses, just can send 1 address to the recipient.
Below is my code:
$checkbox_value = '"st9overfindsolution@gmail.com" => "Admin","st7overfindsolution@gmail.com" => "EZLIN EDZRINA BT MEOR KAMARUDDIN","baby@gmail.com" => "IZUARINI BT MAHMAD SANI"';
$recipients = $checkbox_value;
require 'plugins/mail/class.phpmailer.php';
$mail = new PHPMailer(true);
$mail->IsSMTP(); //Sets Mailer to send message using SMTP
$mail->Host = 'smtp.gmail.com'; //Sets the SMTP hosts of your Email hosting, this for Godaddy
$mail->SMTPDebug = 0;
$mail->Port = 465; //Sets the default SMTP server port
$mail->SMTPAuth = true; //Sets SMTP authentication. Utilizes the Username and Password variables
$mail->Username = 'asf1n@gmail.com'; //Sets SMTP username
$mail->Password = 'gdsA215'; //Sets SMTP password
$mail->SMTPSecure = 'ssl'; //Sets connection prefix. Options are "", "ssl" or "tls"
$mail->From = "aa"; //Sets the From email address for the message
$mail->FromName = "aaa"; //Sets the From name of the message
foreach ($recipients as $email => $name) {
$mail->AddAddress($email, $name);
}
// $mail->AddAddress('dsgas@gmail.com', 'Ong'); //Adds a "To" address
$mail->AddCC("aaa@gmail.com", "sagsa"); //Adds a "Cc" address
$mail->WordWrap = 50; //Sets word wrapping on the body of the message to a given number of characters
$mail->IsHTML(true); //Sets message type to HTML
$mail->Subject = $tajuk_email; //Sets the Subject of the message
$mail->Body = $kandungan_email; //An HTML or plain text message body
For above coding result, I just can send email to st9overfindsolution@gmail.com
, other recipient cannot receive email. Is any wrong for my coding? Hope someone can guide me on how to solve the problem. I think below the coding got something error:
$checkbox_value = '"st9overfindsolution@gmail.com" => "Admin","st7overfindsolution@gmail.com" => "EZLIN EDZRINA BT MEOR KAMARUDDIN","baby@gmail.com" => "IZUARINI BT MAHMAD SANI"';
$recipients = $checkbox_value;
foreach ($recipients as $email => $name) {
$mail->AddAddress($email, $name);
}