CentOS 7.x postfix based email archive server
From Notes_Wiki
<yambe:breadcrumb>CentOS_7.x_postfix_configuration|CentOS 7.x postfix configuration</yambe:breadcrumb>
CentOS 7.x postfix based email archive server
Archive to single recipient address
To archive (copy) all incoming and all outgoing emails from postfix to another server (Typically for compliance and backup) use:
- Edit /etc/postfix/main.cf and add always_bcc=<receipient_address>. For example
- always_bcc=archives@backup.sbarjatiya.com
- systemctl reload postfix
The receipient address should not be on the same email server / domain. You can use a sub-domain such as archives@backup.sbarjatiya.com where backup.sbarjatiya.com email server is different than sbarjatiya.com email server.
Refer:
Archive with same username on destination as source
To archive with same username on destination as source use following steps:
- Edit /etc/postfix/main.cf
- sender_bcc_maps=pcre:/etc/postfix/sender_bcc_map
- recipient_bcc_maps=pcre:/etc/postfix/recipient_bcc_map
- In /etc/postfix/sender_bcc_map use:
- /^(.*)@<domainname>$/ $1@<backup-hostname>.<domainname>.com
-
- For example:
- /^(.*)@sbarjatiya\.com$/ $1@backup.sbarjatiya.com
- For example:
- Similalry in /etc/postfix/recipient_bcc_map use:
- /^(.*)@<domainname>$/ $1@<backup-hostname>.<domainname>.com
-
- For example:
- /^(.*)@sbarjatiya\.com$/ $1@backup.sbarjatiya.com
- For example:
- Optionally, if MX record lookup is not desired and mails need to be delivered to some other address, edit /etc/postfix/transport
- backup.sbarjatiya.com smtp:[in.sbarjatiya.com]:2025
-
- Here, SMTP server on in.sbarjatiya.com is running on port 2025. Also backup.sbarjatiya.com need not be a valid FQDN or it can be different from in.sbarjatiya.com. *If IP address is used then [] are required around the IP address*.
- postmap /etc/postfix/transport
- systemctl reload postfix
Refer:
- https://www.vaultastic.com/docs/How_to_setup_email_archiving_for_postfix
- https://linux.die.net/man/5/transport
<yambe:breadcrumb>CentOS_7.x_postfix_configuration|CentOS 7.x postfix configuration</yambe:breadcrumb>