Connecting to Gmail using CFPOP
This is a brief translation of the original post regarding the same subject in brazilian portuguese.
Researching the web (and also after hours trying some native solution) I could realize a lot of people had already tried to use
After some hours looking for solutions for this, discarding the option to use CFX_POP (paid solution), we and my colleague Jefferson Petillo decided to research some alternative. I choose to go into Java direction and after some time researching I found this post (http://unk1911.blogspot.com/2005/12/gmail-via-pop3-in-java.html).
Based on it, I wrote the following simple lines of code to successfully retrieve messages from my Gmail account using
IMPORTANT: Comparing the original code I had as the base to produce mine, you can realize I omitted the definition ("mail.pop3.socketFactory.fallback", "false") that is equivalent to define it as TRUE. This FLAG makes JVM recovers or not the original “SocketFactory” class used on Pop3 Socket connections that is “javax.net.SocketFactory". If FALSE is defined to “fallback” flag, JVM, from here on, will always use SSL in future Pop3 Socket connections until "mail.pop3.socketFactory.class" is defined back to “javax.net.SocketFactory” instead of "javax.net.ssl.SSLSocketFactory" we are using to implement SSL. For a ColdFusion shared environment it would result on an undesired situation where every Pop3 Socket connection made from any application running that server instance, to use SSL when
Regarding this, the better way to implement this solution would be:
Where “someFlag” will be some variable indicating SSL is required for next
GREAT QUESTION: Why isn’t it already implemented as a simple
Special thanks:
The author of the original Java solution posted here http://unk1911.blogspot.com/2005/12/gmail-via-pop3-in-java.html and Jefferson Petilo for his help, curiosity, effort and sleepiness.
3 comentários:
Thanks! I've been looking for something like this. Will have to give it a whirl.
Thanks for the great tip. I'm running into an issue tho. 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 its because the ssl certificates aren't explicitly accepted, hence that security error. Is there anything you can do to over come that ?
Hi "anonimous", can you provide the code you're using to experience this? So I can do some labs and try to discover the solution and post it here. If you prefer, you can send me an email. Mine is macieljr@gmail.com
Also, if the server you're trying to connect to is private, can you provide me an account for testing purposes?
Thanks for the feedback!
Postar um comentário