PHP mailer multiple address [duplicate]

You need to call the AddAddress method once for every recipient. Like so:

$mail->AddAddress('person1@domain.example', 'Person One');
$mail->AddAddress('person2@domain.example', 'Person Two');
// ..

Better yet, add them as Carbon Copy recipients.

$mail->AddCC('person1@domain.example', 'Person One');
$mail->AddCC('person2@domain.example', 'Person Two');
// ..

To make things easy, you should loop through an array to do this.

$recipients = array(
   'person1@domain.example' => 'Person One',
   'person2@domain.example' => 'Person Two',
   // ..
);
foreach($recipients as $email => $name)
{
   $mail->AddCC($email, $name);
}

Leave a Comment