CFPOP and SSL

One of the reasons I love Adobe’s ColdFusion so much is the fact that it is built on a Java engine and you are able to use a lot of the powerful features of Java from CF. I however don’t get to use this feature often enough, mainly because most of the things I work on daily doesn’t really need anything other than what is provided by the CF natively. And, well, as with anything without practice your skills get dull, so when I had to access a mailbox that is hosted by Gmail using CFPOP I was forced to turn to Google to find a solution.

CFPOP does not support SSL/TLS connections as of version 8, which is quite a big limitation since so many services now support SSL for POP connections. There are quite a few options for work arounds for this but the simplest and quite elegant solution is the one provided by Anuj Gakhar. This solution uses the underlying Java pop service which does support SSL.

 

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

<cfset jProps = javaSystem.getProperties() />

 

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

<cfset jProps.setproperty(“mail.pop3.port”, variables.popPort) />

<cfset jProps.setProperty(“mail.pop3.socketFactory.port”, variables.popPort) />

 

 

Set variables.popPort to the port on which your POP server is accessed. You then call the CFPOP tag as you would normally:

<cfpop action=”getHeaderOnly”

            server=”#variables.popServer#”

            port=”#variables.popPort#”

            username=”#variables.popUsername#”

            password=”#variables.popPassword#”

            maxrows=”5″

            timeout=”60″

            name=”variables.popRecords” />

The underlying Java platform can allow you to perform many tasks that may not be available in ColdFusion, so why not do some experiments?

Share this post:
  • Print
  • email
  • Facebook
  • Twitter
  • Tumblr
  • del.icio.us
  • Digg
  • Reddit
  • Sphinn

Related Posts

This entry was posted in ColdFusion, Java, Programming and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
blog comments powered by Disqus
  • Subscribe to my feed Subscriber via Email Follow Me on Twitter! Check me out on Facebook! Check me out on LinkedIn!