[CLUE-Tech] Bulk Email Question
Jed S. Baer
thag at frii.com
Fri Oct 18 21:33:25 MDT 2002
On Fri, 18 Oct 2002 20:28:06 -0600
Jeffery Cann <fabian at jefferycann.com> wrote:
> 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?
Fork?
If you save the forked PID in a session variable, you can then use the
meta refresh tag to revisit the process every, maybe 30 seconds, and when
the process is finished, do whatever cleanup you need.
> 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();
>
$z = 0;
> 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.";
> }
if (mod($z++,100)) {
echo 'mailed some more';
}
> flush();
> usleep(200000);
> }
>
> Suggestions are appreciated.
Dunno about that. You'd need output buffering turned off, at the least
(oh, I see that's where the flush come in, err, goes out.). Actually, I
don't off the top of my head know what the php modulo function is. But,
the browser'd be gettin' stuff, I think.
Well, decided to RTFM. ref.math.html doesn't list any modulo function.
Abitrary number base conversion -- yeah, got that, but you want the
remainder after division? Sorry bub.
jed
--
We're frogs who are getting boiled in a pot full of single-character
morphemes, and we don't notice. - Larry Wall; Perl6, Apocalypse 5
More information about the clue-tech
mailing list