Gang,
I have been trying to setup an application for my users to send out thousands of emails at a time. When I first tested the script, I commented out the "$mail_sent = @mail(" line so it didn't send out the email. When the line is not commented out and is in production, it takes forever... I read about using SMTP directly to speed things up, but I think using the mail() feature is locking up the server.

I also saw some talk about using the Qmail service instead of Sendmail. I have the PHP sendmail path set to "/usr/sbin/sendmail". Should I take advantage of Qmail? Will it make much of a difference?

The users may want to send out 10,000 - 20,000 emails and I need the system to accomodate this level of usage. I batched the emails into 5,000 emails per page, but it is still taking 5-10 minutes per 5,000.

What's the best appraoch for this?

    As stated in the manual for the mail() command, it is very inefficient for sending large numbers of emails. Either look at the options in the PEAR repository such as the Mail_Queue package, or a third party app such as poMMo.

      I was hoping not to go that route, but I understand why. Do you really think this is supposed to take that long. I didn't really want to setup a CRON to send the mail. I just wanted it to queue up/transfer to the mail server a little faster. Is it possible I don't have the server setup correctly?

        egoehring;10889785 wrote:

        I was hoping not to go that route, but I understand why. Do you really think this is supposed to take that long. I didn't really want to setup a CRON to send the mail. I just wanted it to queue up/transfer to the mail server a little faster. Is it possible I don't have the server setup correctly?

        Well, to quote directly from the PHP manual:
        [indent]Note: It is worth noting that the mail() function is not suitable for larger volumes of email in a loop. This function opens and closes an SMTP socket for each email, which is not very efficient.
        For the sending of large amounts of email, see the » PEAR::Mail, and » PEAR::Mail_Queue packages.
        [/indent]

        As far as not using cron, I know that poMMo does not use cron.

          Write a Reply...