Guide to adding Google Apps email to EHCP

I'm very pleased to be able to finally bring a how to guide to adding Google Apps email to your amazing and free EHCP software. Hopefully this will make it even better.

1. Go to /var/www/new/ehcp and find the apachetemplate file. Open the file in your favorite text editor.

2. Delete this whole section:

ServerName webmail.yourdomain.com
ServerAlias mail.yourdomain.com
ServerAlias email.yourdomain.com

DocumentRoot {ehcpdir}/webmail

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
CustomLog {homedir}/logs/access_log combined
CustomLog /var/log/apache_common_access_log vhost_combined

php_admin_value open_basedir {ehcpdir}/webmail
php_admin_value upload_tmp_dir {ehcpdir}/webmail/data
php_admin_value session.save_path {ehcpdir}/webmail/data

Yep that's right delete this entire section as it interferes with the google cname you'll be entering a little later (I found this out by accident). Save the file and upload to server.

3. Go to your EHCP control panel and click on "edit dns template for this domain".

4. Take out everything that has an mx in it inside your dns template, and add this:

mail.yourdomain.com. IN CNAME ghs.google.com.
yourdomain.com. IN TXT "v=spf1 include:_spf.google.com ~all"
@ IN MX 1 ASPMX.L.GOOGLE.COM.
yourdomain.com. IN MX 5 ALT1.ASPMX.L.GOOGLE.COM.
yourdomain.com. IN MX 5 ALT2.ASPMX.L.GOOGLE.COM.
yourdomain.com. IN MX 10 ASPMX2.GOOGLEMAIL.COM.
yourdomain.com. IN MX 10 ASPMX3.GOOGLEMAIL.COM.
yourdomain.com. IN MX 20 ASPMX4.GOOGLEMAIL.COM.
yourdomain.com. IN MX 20 ASPMX5.GOOGLEMAIL.COM.

Of course replace yourdomain with, well, your domain, and if you don't want mail. to be your address add whatever you want there, such as: webmail.yourdomain.com IN CNAME ghs.google.com.

5. That's it, and it might actually take up to 48 hours to propagate with google so be patient, it took mine about a day and a half to propagate.

6. This last one is a tip, after your email has propagated with google, you can add custom web addresses for Calendar, Docs, etc., by simply adding another cname record in your dns template, like so: docs.yourdomain.com. IN CNAME ghs.google.com.

Good luck!

Comments

Greetings i had done all the procedure as you described exept deleting i just commented lines . But when refresh was made i cant get to mail and when i type mail.mydomain.com i got redirected to admin page instead of google mail page. And also when i try to send message i still recieve it on my hosting email instead of google mail/

You might want to try backing up and deleting the entry make sure you get everything between and including: VirtualHost {webserverip}:333> and /VirtualHost> You have to make sure your virtualhost brakets are set correctly or this can cause all kinds of bad things like apache not starting. I've done my above method on about 5 domains now and all are working correctly with Google Apps.