RFE: Postfix sender_canonical_maps regex

This request is to solve the problem as described in the forum thread at:


The problem is that the default/recommended configuration to append domain names to usernames causes e-mail to be sent out as user.domain.com@host.server.com. This type of address is confusing to end users. Instead, it should be rewritten to its proper form as defined in the virtual alias table, i.e. simply user@domain.com.

In order to accomplish this, it requires configuring a very simple canonical map in Postfix. This small change rewrites all outgoing mail on the server, including from the command line, webmail, etc. This should be installed by default with Virtualmin so that it automatically converts the format as follows:

user.domain.com@domain.com --> user@domain.com

To make this possible, simply add a single line to the Postfix main.cf file:

sender_canonical_maps = regexp:/etc/postfix/sender_canonical.regexp

Then, create the file sender_canonical.regexp with the following line:
/^(.*)\.([^.]*\.[^.]*)@/ ${1}@${2}

Finally, reload the Postfix configuration with the command:
postfix reload

Closed (fixed)