I have exim set up to accept local address with a suffix of -. So if joe is a user then joe-anything is accepted.
However there are some of these subaddresses I want to reject (they have become too spam infested and nothing useful comes on them). Is there are way of doing this before it gets prorcessed by the local user router. Can I do something in an alias file?
I am runing on Ubuntu 10.04
Add another router before the localuser router that only exists to reject the lp/suffix combos you want rejected. Here's an example with the suffixes hard coded:
The other way to go would be to look it up from a file. Same basic concept, just with a file lookup:
The file pointed to by local_parts is just a list of local_parts to reject:
I prefer using routers to do this instead of ACLs because it catches all the edge cases like messages submitted locally (and so which don't trip the rcpt acl), etc.
You can create an acl to reject these addresses. To the "begin acl" section, add something like this:
This will reject the message even if the recipients would otherwise to be accepted. The "recipients" part here is a simple list, you can use any kind of list instead of specifying a file (sql lookup, hardcoded list, whatever).
Just add an alias for them.
I like to manage the rejected subaddresses along with the accepted addresses in the same alias file (I have one for each domain). I also want only one router for each domain.
If you have a router doing a lookup in an alias file, just lookup the $original_local_part first and then the $local_part, as $original_local_part holds the entire address with the suffix (aka subaddress):
Then in the alias file, just add a line for the sub-addresses you want to reject:
So if exim finds the subaddress ("[email protected]") in the first search, it will handle it (fail it in my example), but if not then the first lookup will fail and cause the second to search for just the local part ("[email protected]") and find and accept/redirect that. If there is no subaddress on the current address, it may just match in the first lookup.