V
verbal kint
Hi all,
I am currently working on a email reading program.
I have set up two different email accounts, one that requires a SSL
connection to the server, one that doesnot.
I have two properties file that I load depending on whether the email
account requires an SSL connection or not.
The SSL properties file looks like the following:
-------------------------------------------------------------------
mail.imap.port=993
mail.pop3.socketFactory.port=995
mail.imap.socketFactory.class=javax.net.ssl.SSLSocketFactory
mail.imap.socketFactory.port=993
mail.pop3.socketFactory.fallback=false
mail.imap.socketFactory.fallback=false
mail.pop3.port=995
mail.pop3.socketFactory.class=javax.net.ssl.SSLSocketFactory
-------------------------------------------------------------------
The non SSL properties file is empty
I execute the following code for each account:
Session session = Session.getDefaultInstance(props, null);
System.out.println(props.getProperty("mail.imap.socketFactory.class"));
Store store = session.getStore(serverType);
store.connect(server, username, password); // ----------- line that
causes the problem
When the first account is connecting, it is working regardless of
whether it is the SSL or non SSL account.
However the second one crashes.
If it is the SSL one, it just won't connect
If it is the non SSL one, I get the following error:
javax.mail.MessagingException:
sun.security.validator.ValidatorException: No trusted certificate
found;
I print the "mail.imap.socketFactory.class" property and I do get the
right property during the execution depending on the account.
I am very puzzled ... Any help will be greatly appreciated!
Thanks!
I am currently working on a email reading program.
I have set up two different email accounts, one that requires a SSL
connection to the server, one that doesnot.
I have two properties file that I load depending on whether the email
account requires an SSL connection or not.
The SSL properties file looks like the following:
-------------------------------------------------------------------
mail.imap.port=993
mail.pop3.socketFactory.port=995
mail.imap.socketFactory.class=javax.net.ssl.SSLSocketFactory
mail.imap.socketFactory.port=993
mail.pop3.socketFactory.fallback=false
mail.imap.socketFactory.fallback=false
mail.pop3.port=995
mail.pop3.socketFactory.class=javax.net.ssl.SSLSocketFactory
-------------------------------------------------------------------
The non SSL properties file is empty
I execute the following code for each account:
Session session = Session.getDefaultInstance(props, null);
System.out.println(props.getProperty("mail.imap.socketFactory.class"));
Store store = session.getStore(serverType);
store.connect(server, username, password); // ----------- line that
causes the problem
When the first account is connecting, it is working regardless of
whether it is the SSL or non SSL account.
However the second one crashes.
If it is the SSL one, it just won't connect
If it is the non SSL one, I get the following error:
javax.mail.MessagingException:
sun.security.validator.ValidatorException: No trusted certificate
found;
I print the "mail.imap.socketFactory.class" property and I do get the
right property during the execution depending on the account.
I am very puzzled ... Any help will be greatly appreciated!
Thanks!