2

I have configured postfix + dovecot as per this guide, originally published at http://neranjara.org/article/title/How_to_configure_PostFix_and_Dovecot_for_Virtual_Users_with_out_a_Database_ now defunct. I used virtual users option. Everything works great.

Now I'd like to configure a specific email address to forward all emails to another address but to retain a copy of email in the original mailbox.

How do I achieve this?

Andrew Savinykh
  • 526
  • 2
  • 7
  • 21

2 Answers2

3

You can use the option recipient_bcc_maps to have mails to some recipients cloned and sent via BCC to another email address.

joschi
  • 21,387
  • 3
  • 47
  • 50
  • This works, thank you. A follow-up question, though. I have this in my main.cf "virtual_mailbox_maps = hash:/etc/postfix/vmailbox" and then "@domain.com domain.com/catchall/" in my vmailbox. This catchall destination can't be forwarded using the recipient_bcc_maps method. Is there any way I got these forwarded too? – Andrew Savinykh Nov 01 '10 at 08:25
  • Sure, that's completely possible. Just write `@example.com` in the table referred in `recipient_bcc_maps` instead of a complete email address. Also see the documentation for `recipient_bcc_maps`. – joschi Nov 01 '10 at 08:56
  • But won't this forward *all* emails, not catch all only? – Andrew Savinykh Nov 01 '10 at 09:07
  • It will send a copy of all emails to `*@example.com` to the recipient you've configured. – joschi Nov 01 '10 at 09:25
  • Yeah, this is not exactly what I want. Let's assume I have bob@example.com, john@example.com and jim@example.com. I don't want *their* email to be forwarded. I only want to forward emails that end up in catchall@example.com, which is all email sent to the domain but that doesn't match any of existing addresses. I don't want to repeat all the existing addresses in recipient_bcc_map to avoid duplication of information. – Andrew Savinykh Nov 01 '10 at 09:34
1

Use the always_bcc setting in Postfix main.cf (see http://www.postfix.org/postconf.5.html).

Either use joschis version or create some type of alias.

Alias originalname@example.org => user1@example.org, user@example.org

weeheavy
  • 4,089
  • 1
  • 28
  • 41