0

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!

Alexander
  • 724
  • 2
  • 11
  • 19

1 Answers1

2
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.

Todd Lyons
  • 2,006
  • 16
  • 12
Kondybas
  • 6,864
  • 2
  • 19
  • 24
  • Kondybas's solution assumes you want to filter on just the $local_part, i.e. local users or aliases. If you also want to check the full $local_part@$domain recipient address, create a second router that is the same except the lookup is $local_part@$domain. You can name it dropper_vhost or similar. Make sure to put both of these before any delivery based routers because they are processed from top to bottom, first one matching. – Todd Lyons Mar 12 '15 at 13:59