I use phpMailer to send email with amazon SES, my codes work perfectly. I'm stuck to send email to multiples addresses, when i try to affect more than one address like this $to="abc@gmail.com,def@gmail.com"; it's not working and i have this message error : Mailer Error: You must provide at least one recipient email address. but when i have only one address it's worked. How can send email to multiple addresses ?
$account="username";
$password="password";
$to="abc@gmail.com";
$from="peter@gmail.com";
$from_name="Peter";
$msg="<strong>test smtp with amazon.</strong>"; // HTML message
$subject="HTML message";
require 'class.phpmailer.php';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet = 'UTF-8';
$mail->Host = "email-smtp.us-east-1.amazonaws.com";
$mail->SMTPAuth= true;
$mail->Port = 465; // Or 587
$mail->Username= $account;
$mail->Password= $password;
$mail->SMTPSecure = 'ssl';
$mail->From = $from;
$mail->FromName= $from_name;
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $msg;
$mail->addAddress($to);
if(!$mail->send()){
echo "Mailer Error: " . $mail->ErrorInfo;
}else{
echo "E-Mail has been sent";
}
?>