How do I throttle outbound email with sendmail

I know, I know, I should switch to Postfix. But in the meantime, how do I throttle outbound email (especially email to a single domain) in Sendmail?


What version of Sendmail?

The short answer is you can't... at least not with the control and granularity most people would require/desire.

The more expanded answer is... you can... by limiting the daemon's children (confMAX_DAEMON_CHILDREN in sendmail.mc), but keep in mind that those children are used for both INCOMING and outgoing traffic.

You can also limit the number of queued messages processed every time the queue is run (confMAX_QUEUE_RUN... I think) but once again... its not a very granular/precise method.

I know I was able to successfully throttle sendmail in the past but I believe I had the luxury of doing it on a two-server system... one for inbound (left untouched) and one for outbound (configured the total connection rate).

One other thing you might try is to ignore sendmail completely and throttle the bandwidth at the server level. I know of a few sysadmins who have taken that approach.

Hope this helps.


Not sure how to do it in sendmail.

But I'd say you could do it on a host(MX) by host(MX) basis using iptables rate limiting. I've never used rate limiting in iptables, but I think it would do the trick. All the examples I've seen were for incoming connections, but I can't see why it should not work for outgoing.

This should work as long as the domain you want to throttle on does not share an MX host with a domain you care about.