Hi all,
I help run a website with a lot of members. Throughout the day i have to email members notifications with unique content in each email. I have set up a cron job to check the database for new email notifications that need to be sent every 2 hours. The script is now taking over 2 hours to complete sending and i am looking to make it more efficient. The code below is what i use. When i time the script the delay seems to be from connecting to sendmail which is on the same server. Can anyone give me an idea on how to speed this up? Also what is the best way of finding dead email address's where domains have expired or unknown user?
while($list_array=mysql_fetch_array($info_query))
{
$mail=new PHPMailer();
$mail->From = "noreply@example.com";
$mail->FromName = "No Reply";
$mail->Host = "localhost";
$mail->Mailer = "smtp";
$mail->isSMTP();
$mail->SMTPKeepAlive = true;
$mail->IsHTML(FALSE);
$mail->Body = $list_array[text_body];
$mail->AddAddress($list_array[toemail], $list_array[toname]);
$mail->Subject = "$list_array[subject]";
if($mail->Send())
{
// insert into table notification sent
}
$mail->ClearAddresses();
$mail->ClearAttachments();
$mail->SmtpClose();
}