LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Postfix: forward all account email within domain to another email account? (http://www.linuxquestions.org/questions/linux-software-2/postfix-forward-all-account-email-within-domain-to-another-email-account-773258/)

18Googol2 12-03-2009 01:24 PM

Postfix: forward all account email within domain to another email account?
 
Hello. Im pretty sure this is trivial to config, but I havent had any luck searching on google.

My situation is: I want to forward any emails sent to my domain to another account. So:

Code:

root@domain                    ->      another_acc
any_other_system_user@domain    ->      another_acc
any_unknown_user@domain        ->      another_acc


stormpunk 12-09-2009 02:27 AM

You mean a catchall? That catches emails that don't get delivered anywhere else.
http://www.postfix.org/VIRTUAL_README.html

There's also a bcc map which can send copies to a email address if you send or receive.
http://www.postfix.org/ADDRESS_REWRI....html#auto_bcc

18Googol2 12-09-2009 02:31 AM

My situation is not catchall. Catchall mode will deliver mails of non-exist users only

But I need all mail to be delivered, doesnt matter if recipient is exist or not

egodinho 03-04-2011 01:10 PM

Yes, you can
 
What you are looking for is a virtual alias table and can be done using the following...

First you need to edit, or create if it doesn't already exist, the /etc/postfix/virtual file.

example.com whatever
@example.com user@example.com
After this has been saved you will need to run postmap /etc/postfix/virtual in order to generate the indexed /etc/postfix/virtual.db Postfix will read.

You will then need to edit the /etc/postfix/main.cf and be sure that you have the following line uncommented:

virtual_alias_maps = hash:/etc/postfix/virtual
This will actually let postfix know about the virtual alias table and use it.

The problem with using the luser_relay option as others have mentioned is that this is treated as the user of last resorts for unknown addresses by the local delivery agent. If postfix is only handling mail for one domain this can be utilized for this but it can mask other configuration errors and will likely cause unexpected results if more than one domain is being handled.

The one caveat I feel obligated to mention is that by creating a wildcard alias of this nature you are opening up your mail system to accept messages for addresses that will not exist and run the risk of having the mailbox filled quickly with spam for non-existent mailboxes.


All times are GMT -5. The time now is 07:56 AM.