Exim Mail Server – How to Throttle Outgoing Mail by Domain

eximrate-limitingthrottling

I am using exim to deliver mail generated by a web app. The gmx.net, gmx.de and web.de domains are asking me to throttle the amount of mail I send but I have trouble in getting that configured in exim.

The scenario goes like this:

  1. my web app generates the emails
  2. they are submitted to exim running on localhost via phpmailer
  3. exim puts them in the queue right away (I have queue_smtp_domains = web.de : gmx.de : gmx.net in the config)
  4. on every queue run (every hour) it tries to deliver the mail
  5. after some successful deliveries each of these two domains returns a 421 error code (1.1.1.1 is my IP address in the original log entry which I replaced here). Exim claims that the error occurs strait after connecting to the server:
2019-09-12 14:50:41.157 [19619] 1i8OYb-00056H-01 H=mx01.emig.gmx.net [212.227.17.5]:25: SMTP error from remote mail server after initial connection: 421-gmx.net (mxgmx115) Nemesis ESMTP Service not available\n421-Service unavailable\n421-Reject due to policy restrictions.\n421 For explanation visit http://postmaster.gmx.com/en/error-messages?ip=1.1.1.1&c=irlims

The link they give the advise to reduce the sending rate. That is what I am trying to do.

Every three hours a fixed amount of mail is accepted be the recieving mailserver before the same error message apears again.

I found one question but it looks like the acls will do the rate limiting at step 2 and I don't want that. I want to rate limit at point 4. And only for the two domains in question.

I also found the docs for special retry rules in exim. But I only want to apply a special rule if the domain and the error code match and it seems to me that I can not match the error 421 on connection (only as a reply of a MAIL or DATA or RCPT command can I match it).

How can I configure this kind of throtteling in exim or how else can I get these mails to be accepted at a faster rate?

Best Answer

I have found this thread on the exim mailing list.

They discuss different hacks and workarounds for throtteling including

  • writing a shell script to manually sleep and deliver the messages (with exim -M)
  • postfix as a "smarthost" which apearently can do what we want
  • configuring a router that just sleeps for some seconds and then passes the message to the next router
Related Topic