Configuring CF8 to use Google Apps

Posted By: Mark Aplet 3 Comments March 18, 2009

The biggest issue I have with running my own server is dealing with spam blockers, email servers, DNS servers, etc. For some of you this is easy, and a no brainer. I personally run from it like a screaming banshee. I use google hosted services for all my email needs. They make it easy, rarely ever have downtime, and the spam filtering is second to none!

Google works fine for sending email from my desktop mail client or through the web, but sending mail via scripts programatically has always been a pain in the butt in my experience. That is until today.

I started getting a lot of undelivered emails and decided it was time to look for another option. After much research, I found an article on TACFUG: ColdFusion 8 likes Google Apps. The article is incomplete and only shows some code for step 2. Not very helpful. I assume it had photos but they may have been deleted at some point. It lead me to my own testing and discovery so I guess it did help in some way.

Here is what I found. Google can accept email from your CF server but it must support SSL and TSL Connections. Coldfusion Server versions previous to CF8 did not support this. So If your using an older version of CF there is a workaround using Doug Boude's sTunnel method. Since I discovered that CF8 supports SSL and TSL connections, I will talk about that here.

Configure ColdFusion Admin

This is actually super simple and I wish I had discovered it before. It would have saved me so much heartache and pain in the past. Here is a screen shoot for reference.

  1. Go to the Server Settings for "Mail" and set the Mail Server value to smtp.gmail.com
  2. Set the Username field to a valid username in your google account.
  3. Add the obvious password for this account
  4. Lastly check the two boxes to enable SSL and TSL connections and submit.

Thats really all there is to it. Now when your server sends an email it will pass it off to Google for delivery and you will see the email appear in your sent mail folder in google webmail. Easy as pie!

Tags: ColdFusion · Software

3 comments so far ↓

  • 1 David Crowther // Oct 6, 2009 at 12:19 AM
    I found that by leaving out the username and password in the CF Administrator settings, you can add them in the CFMAIL tag instead. This is useful if you want to use different email accounts that you have under Google Apps. Just make sure you leave out the 'server' attribute in the CFMAIL tag as this didn't work for me when I added it.

    Also, as Google Apps will only show your account email address as the sender even if you use a different email address in the 'from' attribute, you can use the 'replyto' attribute as a workaround. Useful in contact forms if you want to insert the submitters email address into the 'from' field.
  • 2 David Crowther // Oct 6, 2009 at 12:32 AM
    Just checked my own setup in CF Administrator and it seems I do have my username and password added. But you can still use different Google Apps email accounts in your CFMAIL tag.

    I also noted that I have 587 for my server port and I do not have 'Enable SSL socket connections to mail server' ticked.

    I guess there are a few different ways to set it up... :)

    ~ David
  • 3 Mark Aplet // Oct 6, 2009 at 7:53 AM
    In the last 6 months I played around with a few different configurations. All of them worked fine since all the sites on this particular server were my own and I did not mind that the email address was my gmail. Once I added a site that was not my own, I had to come up with a different solution. So now I have a separate mailserver and use it's IP address instead. I guess the take away from this is that using gmail is fine if you can specify a reply to address, and are okay with emails being sent out with your own gmail account.

Leave a Comment

Leave this field empty:

Theme Design By Mark Aplet

Super Powered by Mango Blog

impediments