Kenny Woo

finding new ways to procrastinate.

github twitter linkedin email rss
Forwarding Email using Postfix
Jun 26, 2014
One minute read

Do you have your own domain name? Here’s how you can forward email directed at your domain to another email account (such as Gmail) using postfix.

  • Install postfix (choose “No configuration” during install)
  • Copy main.cf template: cp /usr/share/postfix/main.cf.debian /etc/postfix/main.cf
  • Add the following to /etc/postfix/main.cf:
virtual_alias_domains = mydomain.com
virtual_alias_maps = hash:/etc/postfix/virtual
myhostname = mydomain.com
  • Add the following to /etc/postfix/virtual:
# For a specific email, uncomment this line
#NAME@main.com myemail@gmail.com
# For a catch all email, uncomment the line below instead
#@main.com myemail@gmail.com
  • Run postmap /etc/postfix/virtual
  • Restart postfix: sudo service postfix restart
  • Open port 25 on UFW: sudo ufw allow 25

Back to posts