Throttling outbound emails with Mailman & Exim

Many ISPs have limits on the amount of emails received in a period of time, not respecting this will reduce the reputation of the sender.

Mailman 2 doesn’t support throttling, though there’re some patches in the wild adding this feature. Exim supports rate limiting incoming emails, but not emails going out, though it may be possible to do this with some convoluted configuration.

The easy solution is to rate limit emails coming from Mailman to Exim, so Mailman will retry them later.

This is the Mailman configuration:

DELIVERY_RETRY_WAIT = minutes(15)

Here we tell Mailman to retry sending delayed emails every 15 minutes, this is the minimum possible time, because the retry process only runs every 15 minutes. The default value is 1 hour.

This is the Exim configuration:

acl_smtp_rcpt = acl_check_rcpt

[...]

acl_check_rcpt:
  [...]
  defer hosts = +relay_from_hosts
        ratelimit = 75 / 15m / per_rcpt / $domain
        message = Rate limit exceeded for $domain: \
                  $sender_rate/$sender_rate_period \
                  (max $sender_rate_limit)

Here we’re telling Exim to accept no more than 75 emails every 15 minutes for any given domain. As seen above 15 minutes is the minimum possible for Mailman. The value 75 depends on how many emails you’re sending: look at the exim logs, pick up the domain you’re sending the most emails, and adjust this value accordingly.


Posted

in

,

by

Tags:

Comments

Leave a Reply