Configure address extension in Postfix

email_address_extenstionAddress extension is one of the features known from GMail but you’ll often never think about configuring for your own mail server. I did not think about it for quite some time as I thought it might be complicated to set up this feature, but I was surprised to see how easy it using postfix.

An address extension allows you to extend your email address with a string that does not need to be known by your email server. For the email server to know where the address extension starts, postfix needs to know where it starts. This is done by configuring a delimiter. By default this delimiter is the “+” sign.

Advertisements

If your email address was user1@example.com you could add address extensions like this.

user1+friends@example.com
user1+1382@example.com

Postfix will look for the configured delimiter and split the local-part of the email address. When the first part matches a user, postfix delivers the email to this user without further checking the address extension. The address extension you are using does not need to be known by the server and can be anything. The same technique is used by GMail which also uses “+” as its delimiter. This feature is called “address alias” by GMail.

With your own mail server, you can change the delimiter to whatever symbol you want. The only limitation you have are the allowed characters for an email address. These are specified by the RFC 5322 in section 3.2.3 and as well described on Wikipedia. To configure the delimiter for the address extension, add the following setting to the “/etc/postfix/main.cf” configuration file.

# ADDRESS EXTENSIONS (e.g., user+foo)
#
# The recipient_delimiter parameter specifies the separator between
# user names and address extensions (user+foo). See canonical(5),
# local(8), relocated(5) and virtual(5) for the effects this has on
# aliases, canonical, virtual, relocated and .forward file lookups.
# Basically, the software tries user+foo and .forward+foo before
# trying user and .forward.
#

# Specify the delimiter between user name and address extension
recipient_delimiter = +

When you are deciding on a delimiter, keep in mind that many websites restrict the characters allowed in an email address. A lot of websites do not even allow the “+” sign within an email address. There are many interesting characters in the list of allowed characters from the RFC, but many of the non-alphanumeric characters might be not allowed for registering at websites or web-services.

Choosing a character that is often used in email address, like “.” which is often used to separate given-name from surname or “-” which is often used to separate words in email addresses (as in “do-not-reply@example.com”) has proven a good choice if you want to use your extended addresses on registration pages on the web.


Read more of my posts on my blog at http://blog.tinned-software.net/.

This entry was posted in Mailserver and tagged , . Bookmark the permalink.