docker-mailserver/docs/content/config/user-management/aliases.md

47 lines
2.1 KiB
Markdown
Raw Normal View History

2016-04-24 17:17:17 +02:00
Please first read [Postfix documentation on virtual aliases](http://www.postfix.org/VIRTUAL_README.html#virtual_alias).
2016-05-24 06:08:23 +02:00
### Configuring aliases
2021-01-27 22:07:59 +01:00
You can use [setup.sh](https://github.com/docker-mailserver/docker-mailserver/wiki/Setup-docker-mailserver-using-the-script-setup.sh#alias) instead of creating and editing files manually.
Aliases are managed in `/tmp/docker-mailserver/postfix-virtual.cf`.
2020-05-31 04:52:34 +02:00
An alias is a _full_ email address that will either be:
* delivered to an existing account registered in `/tmp/docker-mailserver/postfix-accounts.cf`
2016-04-24 17:17:17 +02:00
* redirected to one or more other email addresses
Alias and target are space separated.
2020-05-31 04:52:34 +02:00
Example (on a server with domain.tld as its domain):
2016-04-24 17:17:17 +02:00
2020-05-31 04:52:34 +02:00
# Alias delivered to an existing account
2016-04-24 17:17:17 +02:00
alias1@domain.tld user1@domain.tld
2020-05-31 04:52:34 +02:00
# Alias forwarded to an external email address
2016-05-24 06:08:23 +02:00
alias2@domain.tld external@gmail.com
### Configuring regexp aliases
Additional regexp aliases can be configured by placing them into `config/postfix-regexp.cf`. The regexp aliases get evaluated after the virtual aliases (`/tmp/docker-mailserver/postfix-virtual.cf`).
2020-05-31 04:52:34 +02:00
For example, the following `config/postfix-regexp.cf` causes all email to "test" users to be delivered to qa@example.com:
2016-05-24 06:08:23 +02:00
```
/^test[0-9][0-9]*@example.com/ qa@example.com
```
2017-03-19 14:54:58 +01:00
2020-05-31 04:52:34 +02:00
### Address tags (extension delimiters) as an alternative to aliases
Postfix supports so-called address tags, in the form of plus (+) tags - i.e. address+tag@example.com will end up at address@example.com.
This is configured by default and the (configurable !) separator is set to `+`.
2017-03-19 14:54:58 +01:00
2020-05-31 04:52:34 +02:00
For more info, see [How to use Address Tagging (user+tag@example.com) with Postfix](https://www.stevejenkins.com/blog/2011/03/how-to-use-address-tagging-usertagexample-com-with-postfix/) and the [official documentation](http://www.postfix.org/postconf.5.html#recipient_delimiter).
2017-03-19 14:54:58 +01:00
2020-05-31 04:52:34 +02:00
Note that if you do decide to change the configurable separator, you must add the same line to *both* `config/postfix-main.cf` and `config/dovecot.cf`, because Dovecot is acting as the delivery agent. For example, to switch to `-`, add:
```
recipient_delimiter = -
```