Search code examples
androidjakarta-mailpop3email-client

Trying to create an email client but can not connect to pop3 server


I am trying to create an email client but I am unable to connect to pop3 server. I used following links to send email:

http://java.sun.com/developer/onlineTraining/JavaMail/contents.html

http://www.jondev.net/articles/Sending_Emails_without_User_Intervention_%28no_Intents%29_in_Android

Sending Email in Android using JavaMail API without using the default/built-in app

I send emails from both emulator and real device.Now, I am trying to connect to pop3 server to read messages with following properties:

    props.setProperty("mail.transport.protocol", "pop3");   
    props.setProperty("mail.host", server);   
    props.put("mail.pop3.auth", "true");  // smtp authentication - default on  
    props.put("mail.pop3.port", "110");   
    props.put("mail.pop3.socketFactory.port", "110");   
    props.put("mail.pop3.socketFactory.class",   
            "javax.net.ssl.SSLSocketFactory");   
    props.put("mail.pop3.socketFactory.fallback", "false");   
    props.setProperty("mail.pop3.quitwait", "false");   
    props.put("mail.debug", "true"); // debug mode on or off - default off 

    session = Session.getDefaultInstance(props, this);  

But application fails to connect to the server. I am attaching logCat which shows that it fails to load javamail.providers then it loads default providers. Then it fails to load javamail.address, tries to connect to pop3.gmail.com but fails to connect.

I'm new to android, can any one guide me?

logCat_Image1remaining part of image1


Solution

  • Problem is solved, my properties were incorrect. Got help from following link

    how to synchronize application email to server email using java mail in android