Configuring Postfix Mail Forwarding Domains


Configuring Postfix mail forwarding domains is a practical solution for situations where local mailboxes are not available, and the server is not serving as an MX backup. This article guides you through the process of setting up mail forwarding domains, with a focus on forwarding emails to designated destinations. Please note that this guide should not be used if you have relay_domains configured through SQL mapping or virtual mapping.

Setting Up a Mail Forwarding Domain

To establish a mail forwarding domain, let’s take the example of configuring for mail forwarding. Follow these steps:

Edit the /etc/postfix/ file and ensure that the following two lines exist in it:

virtual_alias_domains =
virtual_alias_maps = hash:/etc/postfix/virtual

You can specify more values for virtual_alias_domains separating them by space.

Edit the /etc/postfix/virtual file and set up email forwarding for [email protected] to [email protected] as follows:

If you need to implement a catch-all address for emails sent to [email protected] and [email protected], forward them to like this:

Save and close the /etc/postfix/virtual file.

Run the following command to update the virtual mapping:

postmap /etc/postfix/virtual

Restart the Postfix to apply the change

service postfix reload

By following these steps, you can easily configure Postfix to forward emails to specific destinations or catch-all addresses, depending on your server’s requirements.