Mail forwarding domains

From LQWiki
Jump to navigation Jump to search

Mail forwarding domains

Some providers host domains that have no (or only a few) local mailboxes. The main purpose of these domains is to forward mail elsewhere. The following example shows how to set up '' as a mail forwarding domain usinfg postfix

 1 /etc/postfix/
 2     virtual_alias_domains = ...other hosted domains...
 3     virtual_alias_maps = hash:/etc/postfix/virtual
 5 /etc/postfix/virtual:
 6 postmaster
 7        joe@somewhere
 8       jane@somewhere-else
 9     # Uncomment entry below to implement a catch-all address
10     #         jim@yet-another-site
11     ...virtual aliases for more domains...
  • Line 2: The virtual_alias_domains setting tells Postfix that is a so-called virtual alias domain. If you omit this setting then Postfix will reject mail (relay access denied) or will not be able to deliver it (mail for loops back to myself).
NEVER list a virtual alias domain name as a mydestination domain!
  • Lines 3-11: The /etc/postfix/virtual file contains the virtual aliases. With the example above, mail for goes to the local postmaster, while mail for goes to the remote address joe@somewhere, and mail for goes to the remote address jane@somewhere-else. Mail for all other addresses in is rejected with the error message "User unknown".
  • Line 10: The commented out entry (text after #) shows how one would implement a catch-all virtual alias that receives mail for every address not listed in the virtual alias file. This is not without risk. Spammers nowadays try to send mail from (or mail to) every possible name that they can think of. A catch-all mailbox is likely to receive many spam messages, and many bounces for spam messages that were sent in the name of

Execute the command

   postmap /etc/postfix/virtual" 

after changing the virtual file, and execute the command

   postfix reload 

after changing the file.

More details about the virtual alias file are given in the virtual(5) manual page, including multiple addresses on the right-hand side.