android - Host is unresolved: imap.gmail.com:993 -
I occasionally "host is unresolved" imap.gmail.com:993 "when I'll try Javamail / gmail store.connect below in the Android development environment using GMailReader. Why can it sometimes fail and why not others?
public class GMailReader javax.mail .nothenticator {private String user; personal string password; public GMailReader (string user, string password) {this.user = user; This.password = password;} Public int getUnreadMessageCount () Exceptions thrown {try {properties props = new ;); Store Store = session.getStore ("imaps"); Store.connect (;);); Store = store; session; ("Imap.gmail.com", user, password); folder inbox = store.getFolder ("inbox"); inbox.open (Folder.READ_ONLY); Int unreadMessageCount = inbox.getUnreadMessageCount (); Count the message without return; } Hold (exception e) {Log.e ("getUnreadMessageCount", e.getMessage (), e); Return -1; Maybe I'm opening several examples of GMailReader, and may not be turning them off well. I have not seen this issue in a while because I am out of the producer, and in a close way it seems that the work is being done in this way: public class GMailReader Javax.mail.Authenticator {private String user; Private string password; Personal property properties; Private session session; Private stores store; Private Folder Inbox; Public GMailReader (string user, string password) {this.user = user; This.password = password; } Public zero open () throws exception {try {properties = new property ()); Properties.setProperty ("mail.store.protocol", "imaps"); Session = session. Gate instence (property, this); Store = session.getStore ("imaps"); Store.connect ("imap.gmail.com", user, password); Inbox = store.getFolder ("Inbox"); Inbox.open (Folder.READ_ONLY); } Hold (exception e) {Log.e (this.getClass (). ToString (), E. Gate (), e); }} Public Zero Closure (Boolean Expand) throws an exception {try {if (inbox.isOpen ()) {inbox.close (expunge); } If (store.isConnected ()) {store.close (); }} Hold (exception e) {Log.e (this.getClass (). ToString (), E.getMessage (), e); }} ...
Comments
Post a Comment