John P wrote:
> All works great, however every so often (bi-weekly) I need to send an
> e-mail to 40,000 customers (different e-mail for each one), generated
> using MySQL and PHP's mail() command.

On Sun, 18 Feb 2001, Lukasz Felsztukier wrote:
> I am here facing the same problem myself. We have over 15.000
> subscribed website-monthly-letter receivers. My script (being sent
> till this day on a sendmail system) was dying halfway (probably
> timeout). Triggering it from a command line is unfortunatelly not an
> option (it's done thru a www interface). I am also wondering what's
> the best way to send all these emails.

firstly, y'all are going to have to do some programming if you went to do
this as quickly as possible. saying things like I HAVE to use the mail()
interface in php or not using a command-line interface means you have
little or no control over the delivery process for this specific class of
mail problems.

firstly, qmail-remote and qmail-queue are the two qmail programs you need
to use. your script needs to do something like the following (in pseudo
code)


maxchildren=1000;
children=0;

whenever SIGCHLD decrement children

while (workdoto) {
   get_work();

   if (children == maxchildren ) wait();
   child=fork();

# error conditions in parent
   if (child<0) {
        error, set maxchildrenlower, exit or retry;
   };

# this is the child process
   if (child==0) {
        send mail using qmail-remote
        if !success 
              send mail using qmail-queue
        exit 0 # child finished
   };

# this is the parent process
   if (child > 0 ) 
          children ++
         
}

# wait for children to finish
while (children != 0) wait();
exit
-----------

In this way you'll make the first delivery attempt yourself for each
recipient; avoiding any overhead in the qmail-send process or the queue
management. if the first attempt fails then the message is passed off to
qmail-send to handle, which should be a much lower volume of mail.

RjL
==================================================================
You know that. I know that. But when  ||  Austin, Texas
you talk to a monkey you have to      ||  Email: [EMAIL PROTECTED]
grunt and wave your arms          -ck ||

Reply via email to