Gerardo's musings

(not) just another blog, hopefully, this time around

On Github
On LinkedIn
On Twitter

Receiving and relaying email for my domains over to free webmail accounts.


  • Be able to receive email addressed to email addresses in domains that I own on commercial, free webmail accounts (or any other kind of email system, really).
  • Not pay any extra money for this (beyond what I'm paying for domain registration, DNS hosting, and my server).


  • Have some domains that you're in control of, e.g.: the domain resolves to a host that you control, you have access to the DNS hosting account and are able to add/remove/modify DNS records (especially MX records).
  • Have control over a host on the internet where you'll be pointing some records of your domains to. For this guide, I'm using Debian-based Ubuntu Linux Server distribution version 14.04 LTS.


  1. create a new MX record with the following information (how you enter this into your DNS provider's interface should be easy to figure out):

    host name:
    type: MX
    ttl: default
    priority: 10 (Normal)
  2. sudo apt-get install postfix

  3. Choose "Internet site" option on menu prompt and enter settings that make sense. We'll do the rest of the configuration manually.
  4. Put this at the end of your /etc/postfix/ file:

    ## added by me
    virtual_alias_domains =,
    virtual_alias_maps = hash:/etc/postfix/virtual
    inet_protocols = all
  5. Create file /etc/postfix/virtual and add lines to it like the following:

    ... this will cause any mail for and to be forwarded to

  6. Make sure you generate the "hash" or ".db" file for virtual by doing: sudo postmap hash:/etc/postfix/virtual
  7. Reload postfix config with sudo /etc/init.d/postfix reload, or start postfix in case it is not running already: sudo /etc/init.d/postfix start
  8. Make sure that port 25 (SMTP) is open on your server's ACL/firewall!
  9. Done!


Pretty much anything that might have gone wrong with your postfix configuration will be logged to either one of these upon the package's start or reload:



This comes in very handy for leveraging your ability to support multiple email addresses on the domains that you control while letting you not worry about setting up an actual client, and using existing free webmail accounts for receiving your email.

This approach covers the receiving part very well, but I've made no effort to support sending via your server/hosting, and it's unlikely to work out of the box without additional configuration. My suggestion is to not try to use your server for sending email, and to use your webmail or similar client with a "Reply-To" header if you want. I don't really care too much since I just want the receiving part to work, and later on I can reply to emails that matter to me using my real email address.