Errore invio più e-mail contemporaneamente
-
Salve a tutti, ho problemi ad inviare più e-mail contemporaneamente con PHP.
Ho istallato phpmailer e ho utilizzato uno dei file samples per inviare e-mail che vengono prelevate da un database. Ho sostituito i parametri con quelli del mio sito e mi sono accorta che riesce amandare solo la prima e-mail. Alla seconda da errore e si bloccaSMTP Error: Could not connect to SMTP host. Mailer Error ([email protected]) SMTP Error: Could not connect to SMTP host.
Vi posto il codice
<html> <head> <title>PHPMailer - MySQL Database - SMTP basic test with authentication</title> </head> <body> <?php //error_reporting(E_ALL); error_reporting(E_STRICT); date_default_timezone_set('America/Toronto'); require_once('class.phpmailer.php'); $body = "Ciao"; $mail = new PHPMailer(); $body = file_get_contents('contents.html'); $body = eregi_replace("[\]",'',$body); $mail->IsSMTP(); // telling the class to use SMTP $mail->Host = "smtp.miosito.com"; // SMTP server $mail->SetFrom('[email protected]', 'First Last'); $mail->AddReplyTo("[email protected]","First Last"); $mail->Subject = "PHPMailer Test Subject via smtp, basic with authentication"; @MYSQL_CONNECT("host","user","password"); @mysql_select_db("expo"); $query = "SELECT * FROM email_prova"; $result = @MYSQL_QUERY($query); while ($row = mysql_fetch_array ($result)) { $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $body = "Ciao"; $mail->MsgHTML($body); $mail->AddAddress($row["email"]); if(!$mail->Send()) { echo "Mailer Error (" . str_replace("@", "@", $row["email"]) . ') ' . $mail->ErrorInfo . '<br />'; } else { echo "Message sent to :" . $row["full_name"] . ' (' . str_replace("@", "@", $row["email"]) . ')<br />'; } $mail->ClearAddresses(); } ?> </body> </html>Per favore mi aiutate a capire perché ho fatto migliaia di prove ma senza risultati.
Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi