No SSL With ColdFusion's CFPOP?

I was very surprised to find out that ColdFusion's CFPOP tag does not support POP3 SSL. ColdFusion is over 10 years old now...you've got to add that in, Adobe!

Anyway, I did some digging around, and thanks to a comment on another blog by Darin Tyler, I found an easy fix. You can use some simple Java commands to "force" cfpop to use SSL. In my testing, I used Gmail, and the code is below:

"java", "java.lang.System") />

"mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory") />

   server="pop.gmail.com"
   action="getAll"
   name="popMessages"
   port="995"
   username="[email protected]"
   password="i'mnotgoingtotellyou">
Comments
Jake, I definitely share the frustration that CFPOP doesn't let you specify the use of SSL. They implemented SSL (as well as TLS) in CFMAIL, so why not in CFPOP?

The Java call is the way to go, and I wanted to share one additional technique I've used with it: you'll want to turn SSL off if the user turns it off to access another POP account, or if the same application serves multiple users who don't all use SSL. So after you turn SSL on with the line:



You can turn it off with:

Thank you blog and thank you commenter!
Hey Jake,

I'm actually trying this out but coming up with a few issues. Just tried writing a sample block that will connect to gmail but the server is returning

An exception occurred when setting up mail server parameters.
This exception was caused by: javax.mail.MessagingException: Connect failed; nested exception is: javax.net.ssl.SSLException: untrusted server cert chain.

I'm guessing since the SSL cert was not explicitly accepted, the security sandbox blocks this. Any workaround for this ?

The codes are:


   
   
   

      server = "pop.gmail.com" port = "995" timeout = "10"
   username = "myusername" password = "mypassword">
   

   

Michael,

I can't see a difference between your code and the code I put in my blog entry. Not sure what's going on, unless Google changed things on their end. I wrote this a few months ago and haven't tried this code since, so maybe Google doesn't allow this anymore?
Worked perfectly thanks.
just found this, tested, worked like a charm. Thanks!
Solve my problem.. Thanks a lot.
@Jacob: You ROCK!
One thing to note...I am working on a project today using the above code, and it is not working for me. I'm trying to go against an MS Exchange server, and it looks like I need to install the SSL certificate in my JVM key store. I haven't received the certificate from the Exchange admins yet...if I get it working, I'll probably create another blog entry referencing this one, explaining what I found.
You guys are awesome! This worked like a charm!
The only thing that slowed me up was switching to the correct port for Gmail (995). After I found that it worked like a charm. Thanks.
I tried this for a similar issue and it worked great.
Thanks