Aliasing a Sub-domain with Postfix and Gmail

Google Apps doesn’t allow wildcards for a subdomain which we need to be able to handle replies coming into The Mentor Center.

This tutorial is developed for Ubuntu 12.10 but may work for earlier versions.

First, setup DNS to handle the subdomain MX record. We use DNS Made Easy because their features, price and performance are pretty much perfect. Adjust the following to work with your DNS provider. MX 10 aliasingservername. MX 20 The second entry is a backup spool. You’ll need to be paying for that.

Then setup postfix. We set it up to only allow relaying for specified domains so we don’t get blacklisted.

You’ll want the following lines in /etc/postfix/

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

Edit the virtual file with the subdomain and catch-all address.

vi /etc/postfix/virtual

When you are done, run

postmap /etc/postfix/virtual

Restart postfix. service postfix restart