This article will show you how to copy incoming mail to another mail server using the blind carbon copy (BCC) feature in Postfix. This capability is useful for backup, archive or disaster recovery purposes.

1. Edit the file /etc/postfix/main.cf and add the lines below.
recipient_bcc_maps = pcre:/etc/postfix/backup_bcc.pcre transport_maps = hash:/etc/postfix/transport smtp_generic_maps = pcre:/etc/postfix/generic.pcre


/^(.*)@acme\.local$/ $1@backup.invalid
which tells Postfix to BCC emails to the domain backup.invalid.
| Email for | BCC to |
|---|---|
| johndoe@acme.local | johndoe@backup.invalid |
| janedoe@acme.local | janedoe@backup.invalid |


backup.invalid smtp:[192.168.1.4]
Replace the IP address with the IP address of your backup mail server.
Next, type in the command below to convert it to a database file.
postmap /etc/postfix/transport
This tells Postfix to send all emails for the domain backup.invalid to the specified mail server.


/^(.*)@backup\.invalid$/ $1@acme.local
which tells Postfix to change the email address back to the original recipient before sending it out.
| BCC to | Email for |
|---|---|
| johndoe@backup.invalid | johndoe@acme.local |
| janedoe@backup.invalid | janedoe@acme.local |

5. Restart the Postfix or MailScanner service if you have installed it. Learn how to start and stop services here.
If you encounter any problems, check the log file at /var/log/maillog.Visit the forum to ask for help or to give a comment.
***
Posted on 12/12/2009 and last updated on 5/9/2010
Filed under Backup , Postfix