[CLUE-Tech] Bulk Email Question

Jeffery Cann fabian at jefferycann.com
Fri Oct 18 20:28:06 MDT 2002


Before you call me a spammer...

I have created a PHP email form for a newbie to send out a bulk email to their 
list of email addresses in their database (don't worry, it's opt-in).

In testing this form there is a long delay as the SMTP server accepts about 
1000 emails into its queue.  Sometimes the browser wants to time out because 
there is no output until all email addresses have been processed.

Is there some way I can prevent the stalling from happening?

Here's the relevant code.  Basically, I select a collection of LMOGroups from 
the MySQL database, iterate through the collection and send an email to each 
address in the collection ($obj->email):

$group = new LMOGroup();
$collection = $group->fetchAllGroups();

while (list ($id, $obj) = each ($collection)) {
        if (!mail($obj->email, $topic,
                $msg, "From: $from\r\n".
                "Reply-To: $replyTo\r\n"))      {
                print "Show email failed page.";
        }
        flush();
        usleep(200000);
}

Suggestions are appreciated.
-- 
    Planet Earth (tm)
http://jefferycann.com/



More information about the clue-tech mailing list