Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

What do you use to maintain email contact with a userbase?



2:38 pm on Mar 16, 2011 (gmt 0)

10+ Year Member

I made the mistake recently of emailing my userbase (approximately 3000 registered users) to let everyone know an old but popular site was again functional.

It wasn't a mistake to email them, but rather how I did it set off delay and bounce filters from gMail and AOL, and probably others.

I tried using PHP's pause() function to spread out the emailing, however when I tested this it simply timed out the script.

So my question, how do those of you who have custom coded emailing functions for newsletters, etc. handle the problem of emailing large numbers of users without setting off these filters with email providers?

Kings on steeds

12:06 am on Mar 17, 2011 (gmt 0)

10+ Year Member

are you adding set_time_limit to the script? this is how I would do it.

$subject = 'Hello, world!';
$body = "Hello {#name},\n this is a test,\n thanks, your site";
$from = "No Reply <no-reply@domain.com>";
$batch_size = 100;
$emails = array(array('name'=>'Joe Bloggs','email'=>'joe@blogs.com'), array('name' => 'Jenny Bloggs', 'email'=>'jenny@blogs.com')); //... and so on
$blocks = array_chunk($emails,$batch_size);
foreach($blocks as $emails){

foreach($emails as $email){
$body = str_replace("{#name}",$email['name'],$body);
mail($to,$subject,$body,"From: $from");

Something like this (untested) should send emails in batches of 100 and sleep for 2 seconds this shouldn't trigger rejects, but if it does just sleep for 10 seconds...Also best to run a job like this from CRON.



2:38 am on Mar 17, 2011 (gmt 0)

10+ Year Member

I thought about crons. I'm not familiar with the batch and time limit commands. I'm going to look those up. Sounds promising, thanks much for the examples.

Featured Threads

Hot Threads This Week

Hot Threads This Month