Exim: silently drop messages to given recipients

blackholeblacklistexim

I have an old legacy php application that used to send out a log of debug mails on each aspect of its work. Due to fact that noone care to turn off this feature and also dut to fact that one day we may need these mailing to be send out again I simply want to stop messages to some recipients on my Exim.

So the question is: how can I silently drop (say, redirect to blackhole) messages that are sent to recipients which addresses are listed in text file? The addresess are external one, not the local one.

Funny to say, it is quite easy to compare $local_part@$domain against the text file, but I wan't able to find a variable of single recipient. I can imagine I should create some new router in Exim configuration,

driver = redirect
data   = :blackhole:

but I failed to construct the right condition.

Is it possible at all, and what is the right way to archive it?

Thank you!

Best Answer

dropper:
    driver          = accept
    condition       = ${lookup{$local_part}lsearch{/path/drop.list}{yes}}
    transport       = null_transport

/path/drop.list :

aaron
amanda
bob
. . . . . 

Each time message for listed user arrives, it would be dropped. A large advantage of doing it this way is that the list is checked for each incoming email. Thus when you want to enable/disable receiving messages for any user at any point, you just remove/add a username (or comment/uncomment the username) in the drop.list file; no exim restart is required.

Related Topic