Email address tags in Postfix and Dovecot

What if you could tag the mail address you provide when registering for various services to simplify the management of the inevitable stream of unsolicited mail that follows? If you could register myname+theservicename@mydomain.tld it would make it very easy to recognize mail from that service – and it would make it easy to pinpoint common leaks, whether they’d got their customer database cracked or just sold it to the highest bidder.

The most famous provider of such a service might be Google’s Gmail. But if you run a Postfix server, this functionality is included and may actually already be turned on out-of-the-box. In your it looks like this:

recipient_delimiter = +

The delimiter can basically be any character that’s valid in the local part of an email address, but obviously you want to avoid using characters that actually are in use in your environment (dots (.) and dashes (-) come to mind).

By default, though, such mail won’t actually get delivered if you use Dovecot with a relatively default configuration for storing mail. The reason is that the + character needs to be explicitly allowed. To fix this, find the auth_username_chars setting and add the + character to it (remembering to uncomment the line):

auth_username_chars = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@+

That’s it: A single step to enable some additional useful functionality on your mail server.