Send email to 1 contact array, with phpmailer

0

I use php mailer to send email, and very simple, I use the following line:

// Destinatório e cópia oculta
$email->AddBCC('[email protected]', 'hugo');

But I wanted to know how do I send an email to multiple people in an array?

Could someone give me an example?

    
asked by anonymous 21.07.2016 / 15:45

1 answer

3

You can do this:

$recipients = array(
   '[email protected]' => 'Person One',
   '[email protected]' => 'Person Two',
   // ..
);
foreach($recipients as $email => $name)
{
   $mail->AddBCC($email, $name);
}

Font

    
21.07.2016 / 15:48