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:
- my web app generates the emails
- they are submitted to exim running on localhost via phpmailer
- exim puts them in the queue right away (I have
queue_smtp_domains = web.de : gmx.de : gmx.net
in the config) - on every queue run (every hour) it tries to deliver the mail
- 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?
I have found this thread on the exim mailing list.
They discuss different hacks and workarounds for throtteling including
exim -M
)A rather rough solution:
(Replace
DROP
withREJECT
if this causes throttling sending to other mailservers as well)This example is for gmx+web.de (united internet) - they are not only using 421, but starting with this month with 554 codes, which causes mail loss. Additionally, it seems that they did reset the exception for our IP starting this month. This time the support is also absolutely uncommunicative. And we started to warn users against using gmx/web.de. This happens on a non profit charity in the field of education with over 5000 members.
The mail server on the host retries the delivery for about a week.