Shubham Verma
Shubham Verma

Reputation: 39

PHP send mail to multiple email

I have a code

<?php
if(!empty($_POST['invite'])) {
  foreach($_POST['invite'] as $check) {
   }
$import_emails =  implode($_POST['invite'], ',');
$imp_eml = explode(',', $import_emails);

$mail->AddAddress($imp_eml [0]);
$mail->AddBCC($imp_eml);
......
......
}     
?>

I want to send multiple emails in AddBCC but i am confuse how to send and which type loop i should use for send multiple emails.

have any idea?

Upvotes: 1

Views: 377

Answers (2)

Adam
Adam

Reputation: 1371

AddAddress should be in loop:

foreach ($imp_eml as $addr){
    $mail->AddAddress($addr);
    $mail->AddBCC($addr);
}

Upvotes: 1

zonzon
zonzon

Reputation: 183

You usually can send to multiple recipients by separating them with a ;

edit: woops, forget about it :D

Upvotes: 1

Related Questions