Skip to content

Enabling aliases with delimiters

osnet edited this page Jan 17, 2021 · 1 revision

Enabling aliases w/o touching alias-db

Ever wanted to recieve mails like user-*@mail.com or user+*@mail.com? You need to add an regex in postfix.

The part in postfix main.cf (simplified):

virtual_alias_maps = regexp:/etc/postfix/address_extension

the file addess_extension:

/([^+]+)[-+].*@domain.tld/    $1@domain.tld

If you are using more domains, you need to specify each domain.

There is a version with /([^+]+)[-+].*@(.+)/ $1@$2. This works for recieving but not for sending. Sending mails with - or + as delimiters in it will be trimmed. Some mailservers have troubles with that i.e. mail-tester.com

Change of file needs postfix reload

Clone this wiki locally