Difference between revisions of "Postfix/aliasing"
m (Woozle moved page Postfix/aliases to Postfix/aliasing without leaving a redirect: so as not to conflict with the "aliases" internal app page (not yet written)) |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | ===config files=== | ||
+ | * {{l/fn/abs|etc/aliases}} | ||
+ | * {{l/fn/abs|etc/postfix/virtual}} | ||
===user aliases=== | ===user aliases=== | ||
− | To set up aliases, either edit the file specified by the {{l/same|pfx=main.cf/|alias_maps}} setting in {{l/same|main.cf}} ([[etc/aliases|/etc/aliases]] by default) and then run [[newaliases]] (or <code>postalias /etc/aliases</code>) to update the database, or else use [[Webmin]] (Servers → Postfix Mail Server → "Mail Aliases" icon → "Create a new alias" link). | + | To set up aliases, either edit the file specified by the {{l/same|pfx=main.cf/|alias_maps}} setting in {{l/same|main.cf}} ([[etc/aliases|/etc/aliases]] by default) and then run [[newaliases]] (or <code>postalias {{arg|alias file}}</code>, e.g. <code>postalias /etc/aliases</code>) to update the database, or else use [[Webmin]] (Servers → Postfix Mail Server → "Mail Aliases" icon → "Create a new alias" link). |
There is also a <code>/etc/postfix/virtual</code> file for aliases in virtual domains; it can be edited manually, but you need to run <code>postmap /etc/postfix/virtual</code> after modifying it. | There is also a <code>/etc/postfix/virtual</code> file for aliases in virtual domains; it can be edited manually, but you need to run <code>postmap /etc/postfix/virtual</code> after modifying it. | ||
− | |||
− | |||
− | |||
− | |||
===virtual users=== | ===virtual users=== | ||
By default, virtual aliases seem to get looked up only when email comes from the outside; locally generated emails are "returned" as undeliverable with the error message "Diagnostic-Code: x-unix; user unknown" | By default, virtual aliases seem to get looked up only when email comes from the outside; locally generated emails are "returned" as undeliverable with the error message "Diagnostic-Code: x-unix; user unknown" | ||
Line 23: | Line 22: | ||
* {{l/same|pfx=main.cf/|luser_relay}} = {{arg|whereToSend}} | * {{l/same|pfx=main.cf/|luser_relay}} = {{arg|whereToSend}} | ||
− | The syntax for | + | The syntax for {{arg|whereToSend}} is explained [http://www.postfix.org/postconf.5.html#luser_relay here]. |
'''Examples:''' | '''Examples:''' |
Latest revision as of 20:52, 9 August 2021
config files
user aliases
To set up aliases, either edit the file specified by the alias_maps setting in main.cf (/etc/aliases by default) and then run newaliases (or postalias <alias file>
, e.g. postalias /etc/aliases
) to update the database, or else use Webmin (Servers → Postfix Mail Server → "Mail Aliases" icon → "Create a new alias" link).
There is also a /etc/postfix/virtual
file for aliases in virtual domains; it can be edited manually, but you need to run postmap /etc/postfix/virtual
after modifying it.
virtual users
By default, virtual aliases seem to get looked up only when email comes from the outside; locally generated emails are "returned" as undeliverable with the error message "Diagnostic-Code: x-unix; user unknown"
The following change in main.cf solves that problem –
- change: receive_override_options = no_address_mappings
- to this: receive_override_options =
– but creates a new one, in that externally-sourced messages are now delivered twice (or four times if addressed directly to a virtual user instead of a virtual alias).
Someone who understands the internal structure of postfix could probably figure out what this means (and how to fix it), but I'm still working on it.
catch-all
To set up a catch-all address, edit main.cf and set the following parameters:
- local_recipient_maps =
- luser_relay = <whereToSend>
The syntax for <whereToSend> is explained here.
Examples:
luser_relay = $user@anotherdomain.org
- forwards all email addressed to "invaliduser@firstdomain.org" to "invaliduser@anotherdomain.org"
luser_relay = youraccount@anotherdomain.org
- forwards all email addressed to invalid users to "youraccount@anotherdomain.org".
This page mentions some other parameters but neglects the ones above.