Sub-addressing in Courier Mail Server

Sub-addressing (also know as plus addressing) is common technique for haveing single e-mail accout have multiple e-mail addresses. This multiple e-mail addresses act as e-mail address aliases. In contrast to aliases they don't need any configuration. In exampl, if You have account, you can use subaddresses e-mail like:


If you (or anybody else) will send e-mail to this addresses, if fact they will land in Your mailbox on gmail. Additionally they will be automatically tagged by tag ”forum”, ”tag”, ”foo” or ”bar” respectivelly. You don't need to configure anything, just when asked for email address in forum registration, or on your home page put properly taged e-mail address. This have multiple advantages:

  • you can have different email for different peoples
  • or for registration on multiple forums / wikis / and other systems

this way you can automatically sort your email based to who was inteded to use it. So no more filtering based on „from” address (which can change).


  • if your e-mail with subaddress is compromised you can just block all traffic to it.

Unfortunetly spam bots are getting smarter, and strips subaddreses, so the last statment isn't completly true.

I have for a long time wanted to use sub-addressing in Courier Mail Server, but found practically no information about it. Yestarday i finally found the way and it is actually very simple:

touch ~/.courier-default

This will enable simple sub-addressing, ~/.courier-default is just like ~/.courier but for login-* addresses. So it is more hyphen-addressing (or minus-addressing) but idea is the same as general sub-addressing.

If you want to do something with create ~/.courier-foo script, if you want to do something with login-foo-* put script into ~/.courier-foo-default

This makes system quite powerfull and flexible.

Without ~/.courier-default file (and without ~/.courier-foo) email address will be rejected as not existing.

The same without it, if you have ~/.courier-foo (but no ~/.courier-default) will be rejected. Also will be rejected (it will be processed by: ~/.courier-foo-baz, ~/.courier-foo-default, ~/.courier-default in this order, or rejected if non exists).

If you want to use dots after minus (, file name will be called ~/.courier-foo:baz (dots converted to colon).

More information in „dotcourier” (5) manual.

PS. I personally think that hyphen sign is better than plus. It isn't so obvious that - sign is used for sub-addressing. And it is more compatible with broken forum scripts (which incorectly thinks plus sign is invalid in email address).

BTW. If you will put additionall dots in gmail addresses (ie., gmail will remove them, and deliver email to the same account. (Such accounts also can not be registered if there already exists any account which maps to So it is psuedo sub-addressing :) Remember that you can't have two consecutive dots, and you can't have dots at the beggining or end of the local-part (this befor „at” sign):,,

Most mailsystems are also case insensitive. But email addresses in local-part are generally case sensitive (according to standards of SMT P only destination system can interpret local-part), and you should send email to e-mail address just like it was given too you, don't convert it to lower case befor sending. Use lower case normalization only if you want to search for duplicates (i.e. not allowing double registration). You can make modification to Courier which will make and two separeate account, so they will be handled differently. You can actually do this just using mailfilter rules. So it can be also another form of sub-addressing.

Domain part (after at sign) is already case insensitive (because DNS system is case insensitive). But you also shouldn't normalize it on sending. Only for auxilary operations like double registration problems or statistics you should

There is only one exception for case sensitivity, if strlower(local-part) is equal „postmaster”:, or POSTMASTER@EXAMPLE.COM must all map to the same account (or be handled the similar way).


Enter your comment. Wiki syntax is allowed:
If you can't read the letters on the image, download this .wav file to get them read to you.
blog/sub-addressing_in_courier_mail_server.txt · ostatnio zmienione: 2009/09/23 19:21 przez baryluk
Recent changes RSS feed Creative Commons License Donate Minima Template by Wikidesign Driven by DokuWiki