How to rewrite email addresses before sending outbound messages

How to rewrite email addresses before sending outbound messages


   KB 24526        Last updated on 2023-12-20  




0.00
(0 votes)


Requirement

How to mask the actual email address or domain of the sender or replace them with another address or domain?

Solution

`canonical_maps` is a configuration parameter used by the Postfix mail server to specify the location of the canonical mapping table. In Zimbra, zimbraMtaSenderCanonicalMaps is a configuration parameter that specifies the location of the sender canonical mapping table used by the Zimbra MTA. This table is used to rewrite or transform the sender email addresses according to the specified rules before sending outbound messages. The canonical mapping can be used to enforce a consistent email address format across the organization or to change the domain name of outgoing emails.

For example, if you have a domain name "example.com" and want to replace all instances of "user@example.com" in the outgoing email headers with "user@example.net"

Follow below steps to configure this:

1) Create file postfix_sender_canonical and add the rules:

$ cd /opt/zimbra/conf
$ vim postfix_sender_canonical
user@example.com   user@example.net
@example.com       user@example.net

Save the file.

Each rule in the canonical mapping table contains two columns: the first column contains the original email address or pattern, and the second column contains the transformed email address or pattern.

2) Postmap the file:

$ postmap postfix_sender_canonical

3) Run following command to configure this attribute:

$ zmprov mcf zimbraMtaSenderCanonicalMaps 'lmdb:/opt/zimbra/conf/postfix_sender_canonical'
$ zmmtactl restart

Note: Before applying these steps to the production environment, it is recommended to first test them in a test environment to ensure that it works as expected.

Jump to: navigation, search