How to rate limit outgoing SMTP connections for Postfix

email-serverpostfixrate-limiting

I have a postfix instance running on a VM. The VM provider shuts us down if we exceed a threshold of SMTP connections per minute – something like 10. In a typical day we might send 1000 messages, so 10 is fine. However it is a mailman server so the peak rate often exceeds 10. The port 25 is then blocked for a while. This creates a backlog. Retries on the backlog create "bursts" of connections far higher than 10. The end result is once we are blocked, we remain blocked until someone manually intervenes.

The "obvious" fix seems to be to ensure postfix stays within the limit – ie outbound connection throttling. Or at the very least limit the number of smtp delivery processes running to 1.

Is there a way do to this?

Best Answer

Look at "policyd" for Postfix. That should be able to fix your ratelimiting. That said, 10 SMTP connections per minute seems stupidly low, and I'd challenge the provider on that (600 per hour may be reasonable)