How to set up a Mail Server that uses GMail as the backend, on Ubuntu/Apache with Multiple Domains on Virtual Hosts

July 18, 2015 2k views
Email Apache Ubuntu

I have multiple domains set up on multiple virtual hosts (Ubuntu 14 with Apache).

I want to create a simple email send and receive system that uses GMail accounts as POP3 mailboxes.

I don't need WebMail, or Spam filtering or Virus filtering, etc., because GMail will do that. I don't need IMAP.

Each domain needs a single email address, no more.

What's is a simple recipe to achieve this? (Note that I have virtual hosts, and I would like each domain to get its own email address using that domain).

Step by step instructions will be most helpful!

keywords: postfix dovecot iredmail qmail mx record cname

  • Just a suggestion, do not ignore Spam Filtering and Virus Filerting because once you install postfix to send mails, the server readily becomes vulnerable to spam attacks!

    All you need to do is install Postfix MTA which can send mails and then change it's config file to use GMail ports and authentication. Also when you install Dovecot MDA, you can again set your POP settings to retrieve mails from GMail.

    But the question is, why would someone want to duplicate the content of GMail on his server when he is not going to use Webmail?

    Don't forget to open ports to send and receive mails on your server! For example, Port 25 is the default port for SMTP!

    Here is an article which might come in handy for your to start on your server. You can skip the installationnof SquirrelMail in this article!

    Managed Cloud Hosting For PHP Applications On DigitalOcean IaaS

  • @saurabh Thank you so much for your suggestions. I actually do, in a way, want to use WebMail. Except that I want GMail to be the WebMail client in this case, instead of SquirrelMail or some such. So I was planning to use Dovecot POP3 to retrieve email into GMail, and use Postfix's SMTP server to send from GMail. Should I nevertheless install WebMail? (Also, I may have got some concepts mixed up.)

  • @gentlecalm As stated earlier, you may follow the guide in the article and skip the part to configure webmail. However, even if you install webmail, still you can use Gmail to import mails and send them from your domain mail id.

    Here is another guide I found just for your use case.

  • @saurabh Thank you. I won't be able to use that article though because I have Ubuntu 14 and that article is for CentOS.

  • Well the commands are same just the starting "phrases" are replaced by sudo apt-get :)

    If you compare the commands of CentOS with that of Debian (Ubuntu), you will understand easily!

Be the first one to answer this question.