Just wondered if anyone has had any experience writting/ using a PHP script that handles large (5,000 +) mailing lists. This is what I've written so far for the sending -
I'm using the phpMailer class - http://phpmailer.sourceforge.net/ to connect directly to the SMTP server; so avoiding the slow mail() function, also sending the email's out in batches of 50 with intervals of 30 seconds to prevent tying the server up.
$mail = new phpmailer();
$mail -> IsSMTP();
$mail -> Host = "mailserver.domain.com";
$mail -> From = "firstname.lastname@example.org";
$mail -> Subject = "free spam";
$db = new MyDatabase($dbEzine, $dbServer);
$db -> connect($user, $pass);
SubscriberNewsletterPK = ".$this -> input['topic']."
SubscriberLanguagePK = ".$this -> input['lang']."
$result = $db -> query($sql);
$q = new QueryIterator($result);
$counter = 0;
while($records = $q -> getCurrent())
$mail -> AddAddress($records['EmailAddress']);
$mail -> Body = "hi ! \n\n enjoy your free spam; sent daily.";
$mail -> WordWrap = 50;
if(!$mail -> Send())
echo 'Message was not sent - '.$records['EmailAddress'].'<br>';
echo 'Mailer Error: ' . $mail -> ErrorInfo.'<br>';
echo 'Message sent - '.$records['EmailAddress'].'<br>';
$mail -> ClearAddresses();
if (($counter % 50) == 0)
$q -> next();
Any additional comments/ tips would be most greatful.