Envoi multi destinataires avec PHPMailer
Bonjour, je veux envoyer un mail à plusieurs mail stocké dsn ma BDD avec PHPMailer. Mais j'ai un souci.
Mon code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| $mail = new PHPmailer(); //instantiation de la classe PHPMailer
$mail->SetLanguage('en','language/');
$mail->IsSMTP();
$mail->Host='mon_host';
$mail->SMTPAuth = true;
$mail->Username = 'mon_email';
$mail->Password = '?mon_password';
$mail->CharSet = 'UTF-8';
$mail->From ='mon_email';
$mail->FromName = 'Nom_emeteur';
$mail->Username = 'user_name';
//requete de recuperation des email
$sqlMail = $connect_db->prepare("SELECT * FROM email");
$sqlMail->execute();
$tab = array();
while($dataMail = $sqlMail->fetch(PDO::FETCH_OBJ)) {
$tab[] = $dataMail;
foreach($tab as $cle => $val){
$mail->AddBCC(implode($val,''), ',' );
}
}
$mail->AddReplyTo('mail_de_reponse');
$mail->Subject=$_POST['titre'];
//Corps du message
$mail->Body='<html><body><head><style>.entete{.entete{width:630px; height:100px;}.contenu{border: solid 1px #D7D7D7; width: 630px; height:auto; padding:5px; margin-bottom=10px; margin-top:90px;}';
$mail->Body.='.footer{font-family:Georgia, "Times New Roman", Times, serif; font-size:11px; margin-top: 15px;}a {color:#0486c4;}.gris{background-color:#d7d7d7;}';
$mail->Body.='</style></head>';
$mail->Body.='<div style="background-image:url(http://karablog.site88.net/images/bg-header-mail.png); width:630px; height:100px;" /><br />';
$mail->Body.='<div class="contenu">'.$_POST['message'].'<br /><br /><br /><div style="width:90%; margin= 10px 0 10px 0"><b>Ce mail vous est envoyé par l\'équipe d\'administration du Portail de Sciences & Progrès, merci de ne pas y répondre</b></div>';
$mail->Body.='</div><div class="footer">';
$mail->Body.='©Sciences & Progrès - Tous droits réservés. |';
$mail->Body.='<a rel="nofollow" target="_blank" href="#">Vous désabonner de cette newsletter</a></div></body></html>';
if(!$mail->Send()){
echo $mail->ErrorInfo;
}
$mail->SmtpClose();
unset($mail); |
Citation:
Erreur:
Warning: implode(): Invalid arguments passed in D:\EasyPHP-12.1\www\gestion-newsletter\_ajouter.php on line 92
SMTP Error: The following recipients failed: , ,
NB: Pour l'envoi à un seul mail ça fonctionne sans problème.