- Home
- Categorie
- Coding e Sistemistica
- Coding
- Errore invio più e-mail contemporaneamente
-
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
[PHP]<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>[/PHP]Per favore mi aiutate a capire perché ho fatto migliaia di prove ma senza risultati.