Postfix/aliasing

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< Postfix
Revision as of 14:42, 9 August 2021 by Woozle (talk | contribs) (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))
Jump to navigation Jump to search

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 /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.

Notes:

  • Webmin seems to automatically run newaliases when you add or modify an individual alias, but not when you use it to edit the /etc/aliases file directly. Changes made to /etc/aliases will not take effect until the database is updated.
  • Stopping and starting the postfix daemon does not update from the aliases file; you still have to run newaliases.
  • see aliases for more information.

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 –

– 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:

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.