Wednesday, March 10, 2010

postfix canonical maps

mail admins complain that there are bounces messages
due to invalid non-routable email addresses in our environments.
since our *nix servers send out regular system and application
messages with the sender local to those systems, there are a lot
of instances were replies to these bounce back or sent to
mail admin catch-all folders due to the invalid
addresses.

example:

hostA.localdomain.cib sends out messages (from root) to
an application user.with email user@validdomain.com,
user is on vacation and has set out an out-of-office
reply.
ooo reply sends out email addressed to root@hostA.localdomain.cib
with the message bouncing back to user@validdomain.com or
gets sent to a mail admin inbox folder.


so as not to touch any application settings, canonical
mappings in postfix have been used.


in /etc/postfix/canonical
@localdomain.cib    admin.user@validdomain.com

then run (cwd is /etc/postfix):
postmap canonical

(the file /etc/postfix/canonical.db gets created or updated)

in /etc/postfix/main.cf
canonical_maps = hash:/etc/postfix/canonical

then run:
/sbin/service postfix reload

(if additional changes are needed in the canonical file, no need
to reload postfix).

from here on, messages will appear to have come from the email address:

admin.user@validdomain.com


NOTE: above example affects all messages coming from that machine.
it can be configured on a per user or per address setup. in this case, it
is "domain wide" from the machine's point of view.
please read the /etc/postfix/canonical file - it
contains documentation on how it is used.

0 comments:

Post a Comment