Accessing GMail with CFMail

It sounds a pretty trivial thing, to access GMail from CFmail, but for those who’ve tried it, it will awaken nightmares.
Even though GMail and CFMail both have the word Mail in them, you cannot access GMail smtp via a CFMail tag in ColdFusion. That is because CFMail does not support SSL. What a shame. For those who deploy ColdFusion on Linux/Unix systems, there’s still hope in the form of Stunnel, a small GNU utility that acts as an SSL wrapper, allowing you to encrypt regular tcp/ip connection inside SSL. Setup is simple, and it works a treat.

You can get it at: www.stunnel.org


4 Responses to “Accessing GMail with CFMail”

  • harel Says:

    This also applies for CFPOP. As of CF8, CFMail does support SSL and TLS.
    However, CFPOP does not….

  • Philip Says:

    In CF8, add these 3 lines above your CFPOP to enable SSL.

  • Philip Says:

    darn it stripped the cf tags from my last comment. trying again without less/greater-than symbols

    cfset javaSystem = createObject(“java”, “java.lang.System”) /

    cfset javaSystemProps = javaSystem.getProperties() /

    cfset javaSystemProps.setProperty(“mail.pop3.socketFactory.class”, “javax.net.ssl.SSLSocketFactory”) /

    cfset javaSystemProps.setProperty(“mail.smtp.socketFactory.class”, “javax.net.ssl.SSLSocketFactory”) /

  • harel Says:

    Philip, you is a * !

Leave a Reply