wakaxx/javamail-android

Not trusted server certificate

Opened this issue · 4 comments

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

but the application in my nexus on is run well!

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

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

hey,maybe you can check your sysdate.

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

hey,maybe you can check your device's sysdate.

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