Send e-mail to 1 contact array, with phpmailer

Asked

Viewed 162 times

0

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

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

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

Could someone give me an example?

1 answer

3


You can do it like this:

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

Source

  • hum ok vlw. I’ll test here

  • this way: Fatal error: Call to a Member Function Addbcc() on string in

  • Managed to find bug @Hugoborges ?

  • yes, I have put a variable with the wrong name :), thank you

  • Ah then blz. I had only seen the comment now haha.

  • hahah tranquil. I’m having trouble assembling the array using while has how to help me?

  • 1

    Sure, you can post another question. Or add me to Skype.

  • vlw, follow the link: http://answall.com/questions/141988/montando-um-array-com-php-para-p-phpmailer

Show 3 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.