Coldfusion CFPOP doesn't support POP3 SSL. I dont know when Adobe will implement this ability, meanwhile I have created custom tag which support SSL connection which I like to share with you. Java class java.lang.System can be used to enable the SSL support with coldfusion CFPOP tag.
<cfset javaSystem = createObject("java", "java.lang.System") />
<cfset javaSystemProps = javaSystem.getProperties() />
<cfset javaSystemProps.setProperty("mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory") />
We just need to put above three statements before using CFPOP tag and it will enable SSL for pop3 access, but this not end I my case I wanted to access some pop accounts with SSL and some of them without SSL. In this case we require to disable SSL for CFPOP tag by passing below statement
<cfset javaSystem = createObject("java", "java.lang.System") />
<cfset javaSystemProps = javaSystem.getProperties() />
<cfset javaSystemProps.setProperty("mail.pop3.socketFactory.class", "javax.net.SocketFactory") />
Rather than writing three statements everytime I preffered to create custom tag which allow us SSL enable pop3 access by adding extra attributes SSL.
<cfparam name="attributes.SSL" default="false">
<cfif attributes.SSL >
<cfparam name="attributes.port" default="995">
<cfelse>
<cfparam name="attributes.port" default="110">
</cfif>
<cfset javaSystem = createObject("java", "java.lang.System") />
<cfset javaSystemProps = javaSystem.getProperties() />
<cfif attributes.SSL>
<cfset javaSystemProps.setProperty("mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory") />
<cfelse>
<cfset javaSystemProps.setProperty("mail.pop3.socketFactory.class", "javax.net.SocketFactory") />
</cfif>
<cfpop attributecollection="#attributes#"/>
<cfif structKeyExists(attributes,"NAME")>
<cfset caller[attributes.Name] = variables[attributes.name]>
</cfif>
This one work fine for me so far. Ofcourse there is little pain putting underscore between cf and pop :) but still it is better than adding three line of code everytime.
Sep 06, 2010 12:27 PM
Nov 14, 2009 at 6:27 AM This is a cool screen idea ! It is very interesting indeed.Thank you for your info.i love to read all info.