SENDMAIL Limit max number of e-mails sent per hour

Cyril_M used Ask the Experts™

I run a RedHat Entreprise Linux 5 server with apache virtual hosts.
My users use php scripts to send emails.
But some of them send hundreds of emails and it overloads my mailserver.
That's why I would like to delay the sending.
In my current configuration php is configured to send emails to the local host running sendmail. Sendmail is configured to relay the emails to my mail server running POSTFIX.

I read something about limiting the number of emails using :
define(`confMAX_QUEUE_RUN_SIZE', 5);
and using sendmail with the following command instead of the daemon launched by REDHAT :
sendmail -bd -qp10m.

I read , it should limit the queue to 5 emails every 10 minutes but it doesn't work.
Do you know why or do you have another solution for me ?

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
The -bd -qp10m only says how often to process the queue,
nothing about how to behave under load.

You also need to tell the server incoming mail from clients should
be queued.  Normal server configs will try to process (deliver/relay)
mails as they are submitted.

A couple of parameters in control this.

    #define('confQUEUE_LA',80);  #could be confQueueLA
    # load average at which we just queue messages
    O QueueLA=80

Set this to a low number so when the server begins to
get loaded, the flood will spill into to the queue vs. trying
to handle in real time.

If you want to control this absolutely, change from background to queue:

    # default delivery mode
    O DeliveryMode=background

This unnecessarily makes everything queue and wait for
the next run - adding delay even when the server is relatively idle.

    # limit on number of concurrent queue runners
    O MaxQueueChildren=10

When the queue is processed you can limit how many msgs it
tries to run concurrently.  Sendmail isn't very cpu-intensive so
you need to go more on memory size and the bandwidth of your
outgoing network (for remote delivery).

These options and more are described in detail at:


Thanks for your help.

I applied the modifications and I restarted the sendmail server.
In my RHEL server I changed /etc/sysconfig/sendmail from QUEUE=1h to QUEUE=5m

The option I previously missed was "define('confDELIVERY_MODE','q');" to switch in queue mode.
After my restart I had the message :

Feb  2 09:07:58 WEBLIN5 sendmail[17695]: starting daemon (8.13.8): SMTP+queueing@00:05:00
Feb  2 09:07:58 WEBLIN5 sm-msp-queue[17704]: starting daemon (8.13.8): queueing@00:05:00

How do I know the amount of mails sent via sendmail on RHEL5?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial