Like all of my contemporaries I was brought up on the staple of Yahoo! mail and Gmail webmail services. Without being offensive I have to say that I find the Roundcube and SquirrelMail interfaces quite functional but rather unappealing. Therefore ever since Google stopped freely hosting emails for other domains I had been forced to lead a difficult life. I miss all those awesome tools like sophisticated spam control as well as the aesthetics. Then there is the cost factor: we have about 10 employees in our organisation who use email and paying $50 a month to Google for email goes against my frugal nature and I don’t really have the time to spend messing with Postfix and Exim either; I tend to avoid Sendmail like the plague it is.
I recently stumbled upon a method to use free Gmail accounts and Postfix mail forwarding thus allowing you to use Gmail to freely host your own mail. It allows you to use Google Webmail for email using your own domain like yourdomain.co.zw and look professional without putting a hole in your pocket.
What you will need.
- Free Gmail accounts for each user that you have on your domain.
- Your own domain such as yourdomain.co.zw . You can use Name.co.zw to register a .co.zw domain for $10/a year domain with ZISPA now.
- A VPS or dedicated server running Linux. I would recommend using Ubuntu ( I will be assuming you are running ubuntu in this guide.) It wouldn’t really matter if the device is metered or not because you are not going to eat a Terabyte/Month using email; and if you do. it means your are using the wrong solution anyway. Even a low end device will do.
- Learn basic commands, this will include downloading Putty onto your Windows device and using it to log into your server.
How to implement the configuration
- After buying your VPS, ensure that the MX record for your domain is pointing towards the VPS. You can confirm this by logging into your server and using the dig command e.g.: dig yourdomain.co.zw and reading the output. You should see the IP address mentioned somewhere in the output.
- Install Postfix ( Do not use the tasksel command to install a Mail server setup, we just need Postfix here not Dovecot and the what-nots) using the command: sudo apt-get install postfix Choose the appropriate setting. The “Internet site ” configuration will do just fine.
- By default Postfix will be listening on port 25, if you are one of those paranoid folks who thinks everyone is out to get them, then follow this Ubuntu guide to setup secure ports
- Edit the /etc/postfix/main.cf file using your favourite editor (use nano if you are a beginner) and add the following lines at the end of the file:
virtual_alias_domains = yourdomain.co.zw
virtual_alias_maps = hash:/etc/postfix/virtual
5. Edit/Create the file /etc/postfix/virtual add emails addresses for which you want the mail to be forwarded and their corresponding Gmail accounts.
# Forwards mail from @youdomain.co.zw to firstname.lastname@example.org
The first address is the one for which Postfix gets the mail and the second is the Gmail address to which it forwads the email to. Note there is a space between the two addresses. It is also possible to forward the emails to multiple domains e.g.
email@example.com firstname.lastname@example.org email@example.com
Although you should know the folks at Hotmail like to read other people’s mails.
6. You might also need to get all the email for your domain and have it forwarded to a specific email address.
#catch all mail bound for @yourdomain.co.zw
@yourdomain.co.zw firstname.lastname@example.org email@example.com
7. After you are done close the file and run the command:postmap /etc/postfix/virtual
8. Reload the Postfix configuration using the command: sudo service postfix reload
9. Test to see if the set up is working by sending yourself mail to your @yourdomain.co.zw address using another email address. The email should appear in the appropriate Gmail inbox.
N.B This is a simple setup and does not cover all the available options; it is meant for Joe User and Sons Ltd not Big Company Ltd. I am just a humble accountant so the Admins out there please feel free to add other relevant tips in the comment section.
Of course you have to change the names like yourdomain.co.zw and firstname.lastname@example.org to actual domains and addresses that your domain uses.
Image Credit: Google
Concept Credit: BinaryTide