Date

Some low-life spammer has started forging messages from my domain. My mail server is receiving many deliveries per second, all bounces for users that don't exist at my domain. Unfortunately I have (had) a catch-all alias that put mails for all unknown users into my mailbox. Ooops.

I'm in the habit of making up e-mail addresses within my domain, in order to keep track of where people get hold of my e-mail address. So if Amazon want my e-mail address, I'll tell them it's alex-amazon.com@example.com. That mail will still get to me because of my catch-all alias, but I'll be able to tell that something fishy's going on if somebody else starts to send me mails to that address.

Most of the bounced joe-job e-mails are sent to a generated address, e.g. JohnSmith@example.com. I want to discard those mails, yet still accept the alex-whatever@example.com addresses that are meant for me. How can I do wildcard address aliasing with Exim?

The short answer is, you can't. My catch-all alias looks like this:

*: myuser@localhost

It would be nice to write this:

alex-*: myuser@localhost

...but unfortunately it doesn't work. Fortunately Exim has a little feature that is nearly as good. You can strip off a wildcard suffix from the username before delivery is attempted. Just add these lines to the appropriate router declaration:

local_part_suffix = -*
local_part_suffix_optional

Now any e-mail with a '-' character in the username will have that suffix part stripped off before delivery is attempted. So now my alias rule looks like this:

alex: myuser@localhost

Any emails to alex or alex-ANYTHING will come to me. Everything else gets quickly rejected as unroutable.

Phew!