Hi,
You'd be better off running this process from a command line, i.e. not
through your Web Browser as I'm more than certain that it will timeout if
you are to send 3000+ emails in a loop :). And then you'll have to start
again , and I'm sure your client won't be so happy if they were to get
multiple copies of the same emails even if they've asked for it:)

You can still write the program in PHP to run from the command line. There
are only a couple of changes that you have to make (if you have complied PHP
to be both stand alone and Web plugin) to enable this.

Also if you were to do this, I wouldn't use mail() function. What I'd do is
run sendmail from the command line (with switches) to basically, get
sendmail to handle *all* deliveries. The beauty of this is that with certain
switch you use from the command line you run sendmail in *batch* mode i.e.
it won't try to send the email straight away but put them into the queue.

The advantage of this is that you can crunch through the list much quicker.
And even if your server crash the emails would already be in the queue so
you won't have to redo it :).

Just a few pointers :) HTH.

> Hi,
>
> I need to send a broadcast email to our customers (about 3,000
> emails). The
> data is being drawn for the DB, and will be personalized. Obviously, the
> code to do this is only a few lines. However, I am concerned with the load
> it will put on the system trying to loop through and mail() 3,000+ times.
> Because of the overhead I anticipate this will cause the server, I am
> planning to do it late in the evening.
>
> My concern is this... will such a loop calling mail() cause PHP/Apache/the
> box/etc to crash under normal circumstances? We have a pretty beefy box, I
> just have never tried broadcasting through PHP. Also, if there is any
> reasonable chance for such a failure, is it possible to put timed
> pauses in,
> say half a second or so before it continues the loop. I've never heard of
> inserting pauses into the execution of PHP code, not sure if its possible.
> If it were, I would think this could combat some of the load, and prevent
> the bottleneck from building backlog until failure.
>
> Who knows, maybe this type of routine won't even make my box
> flinch (P3-833,
> FreeBSD, 256 megs), that's why I'm asking ahead of time. I'd hate to see a
> crash, mainly because I'll have no idea where it left off, and will end up
> sending 2 or more emails to some people if I have to run it more
> than once.
>
> Thanks.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to