timis1 / javamail-android

Automatically exported from code.google.com/p/javamail-android
0 stars 0 forks source link

Not trusted server certificate #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,
  i get an error(Not trusted server certificate) ,when i use IMAP connect Gmail  server in the mobile oem.

  so ,i use explorer open the site:https://www.google.com, say  not valid certificate yed

Original issue reported on code.google.com by bean....@gmail.com on 29 Jun 2010 at 9:57

GoogleCodeExporter commented 8 years ago
but the application in my nexus on is run well!

Original comment by bean....@gmail.com on 29 Jun 2010 at 9:58

GoogleCodeExporter commented 8 years ago
I get "Not trusted server certificate" error when I am trying to connect to 
exchange server through IMAP. I can get my google emails with the same method 
but not the exchange one's. 

is there a way to make android the certificate automatically? 

Here is my code: 

Properties props = System.getProperties();
        props.setProperty("mail.store.protocol", "imaps");
            try {
                Session session = Session.getDefaultInstance(props, null);
                Store store = session.getStore("imaps");
                store.connect("mail.dancorproiect.ro", "cata", "qwe123..");
                System.out.println(store);

                Folder inbox = store.getFolder("Inbox");
                inbox.open(Folder.READ_ONLY);
                Message messages[] = inbox.getMessages();
                for(Message message:messages) {
                try {
                    System.out.println(message.getContent());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        } catch (NoSuchProviderException e) {
            e.printStackTrace();
            System.exit(1);
        } catch (MessagingException e) {
            e.printStackTrace();
            System.exit(2);
        }

Original comment by aLync...@gmail.com on 7 Mar 2011 at 8:12

GoogleCodeExporter commented 8 years ago
hey,maybe you can check your sysdate.

Original comment by bean....@gmail.com on 6 Apr 2011 at 2:18

GoogleCodeExporter commented 8 years ago
hey,maybe you can check your device's sysdate.

Original comment by bean....@gmail.com on 6 Apr 2011 at 2:41