How would i send an email, to say 3000 recipients – with a Max 500 emails / hours on my dedicated IP? So far my thought is to send each email every 9 seconds, this would come to about 450 emails an hour… but how could i do this?
My plan for the sending of the emails would be the following…
$emails = ARRAY OF EMAILS, MYSQL RESULT
for($emails){
mail($subject,$row[email],$headers);
}
This wont work, wrong kind of statement but this concept anyway….
What I would do is :
The trick is : you have to know which mails where already sent.
Ordering the mails by id in your DB, or something like that, and using limit, would be OK, I suppose
If you want to sleep for a while between mails, use the
sleepfunction ; something between 2 and 5 seconds would probably be OK, to be sure you script the chunk of 450 mails is finished before the script is re-launched by cron.And, thinking about it :
mailfunction : there are plenty of other possibilities, using libraries that are well-tested and provide lots of functionnalities, already developped : don’t re-invent the wheel 😉Here are a couple of libraries I can think about :
Zend_MailPEAR::Mail