I have a very simple Exim configuration that's just forwarding all mail to a set of destination addresses. When immediate delivery to an address fails, the message is added to the queue (and then processed by the retry rules). I want to change this so that if immediately delivery fails, the message is :blackhole:d. (It's ok if a bounce is generated instead, as I'll just redirect the bounce to the :blackhole:).
This needs to occur for temporary failures (i.e. 4xx) as well as permanent (i.e. 5xx) ones.
I understand that this means that if delivery can't be done immediately the message will be permanently and irretrievably lost. In this particular context, that isn't a problem.
Reading over this, it sounds suspiciously like "how can I improve my spamming Exim server". That really isn't what this is for, and if you can figure out a way I can prove that, I'm happy to do so!
Exim has extensive configuration for setting the retry times. In your exim.conf, there will be a retry section near the bottom. The retry configuration is three fields, the email address, the error code causing the failure and a list of timing patterns. These are defined as a group of three numbers: a letter behaviour code, the length of time to apply this rule and an interval to retry. For example:
can be read as "For 2 hours, try of a fixed internal every 15 minutes",
You could try setting an empty retry:
It's possible that exim gets upset by this. Instead, you could use a single retry of a minute:
This isn't exactly what you asked for, but it's pretty close.
There's also options for changing it for particular email addresses and for different return codes.
Set retry to something absurdly long, cron a script to pull message ids from
exim -bpu
in queue greater than length x, then remove withexim -Mrm <msgid>
You can alternatively run exim as a non-queueing daemon with
mua_wrapper = true
. Look at Section 48 "Using Exim as a non-queuing client", it may do what you need.Can you set
system_filter
option in your exim.conf. Ater, in your configuration system filter file, create one rule like that:After first delivery, exim will put message in the queue again but when try to process again, it will discarded.