Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Postfix Documentation
Previous Page Home Next Page

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:

 1 /etc/postfix/
virtual_alias_domains = ...other 
hosted domains...
virtual_alias_maps = hash:/etc/postfix/virtual
 5 /etc/postfix/virtual:
 6     [email protected] postmaster
 7     [email protected]        [email protected]
 8     [email protected]       [email protected]
 9     # Uncomment entry below to implement a catch-all address
10     #         [email protected]
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 [email protected] goes to the local postmaster, while mail for [email protected] goes to the remote address [email protected], and mail for [email protected] goes to the remote address [email protected] 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 [email protected]

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.

Postfix Documentation
Previous Page Home Next Page