Jason Warner wrote:
I've been working on implementing the option to use an ssl connection
when establishing a socket for pop3. I'm having an issue finding a
way to determine whether to use the ssl connection or not. For the
SMTPTransport, this is done when the object is instantiated by passing
in a boolean value for this. Is there an easier way to this for the
POP3Store rather than tracking down all instances of it and specifying
the same boolean value?
I'm not totally certain I understand your question, so let me just
explain how that boolean is used with the SMTPTransport class and then
point you to how Sun does SSL enablement of POP3 in their
implementation, which appears to be very similar to what has been done
for SMTPTransport.
There are actually 2 SMTP transport classes that can be configured and
used: SMTPTransport and SMTPSTransport. SMTPSTransport is a subclass
of the first, and just specifies "true" for the useSSL argument of the
constructor. It also uses a different default port an protocol name
("smtps"). Note that superclass constructor is protected, so only
available to the subclasses. That superclass constructor is the only
difference between the SMTPTransport and the SMTPSTransport class. So
the chose of using a secure connection is determined by which transport
is requested in the application code, not by passing in a boolean. The
underlying SMTPTransport implements the SSL support, but it is only
enabled when the SMTPSTransport is used.
Sun appears to do something very similar with POP3. There provider set
includes a POP3Store and a POP3SSLStore. Here's the javadoc for the
POP3SSLStore:
http://java.sun.com/products/javamail/javadocs/com/sun/mail/pop3/POP3SSLStore.html
Since it only appears to have added the single constructor, I'm guessing
this is very similar to how the SMTPTransport stuff was handled. The
store provider name that maps to the POP3SS:LStore class is "pop3s".
The default port appears to be 995.
Rick
-Jason