Configuring CF8 to use Google Apps
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.
- Go to the Server Settings for "Mail" and set the Mail Server value to smtp.gmail.com
- Set the Username field to a valid username in your google account.
- Add the obvious password for this account
- 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 ↓
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.
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
Leave a Comment