I am trying to add an icloud account . I am using javamail . Outgoing connection is working. But incoming testing is failing
IMAP (Incoming Mail Server) information: Server name: imap.mail.me.com Security type: Select SSL Port: 993 Username:[email protected] Password: Your iCloud password
props.setProperty("mail.store.protocol", sProtocol);
props.setProperty("mail." + sProtocol + ".host", acct.sIncomingHost);
props.setProperty("mail." + sProtocol + ".port",
acct.sIncomingHostPort);
props.setProperty("mail." + sProtocol + ".timeout", "30000");
props.setProperty("mail." + sProtocol + ".connectiontimeout",
"30000");
if (acct.iIncomingHostEncryption == Constants.ENCRYPT_TLS) {
Log.i(TAG, "STARTTLS...");
props.put("mail." + sProtocol + ".starttls.enable", "true");
props.setProperty("mail." + sProtocol + ".ssl.trust", "*");
props.setProperty("mail." + sProtocol
+ ".ssl.socketFactory.class",
"com.myproject.SEMPSSLSocketFactory");
props.setProperty("mail." + sProtocol
+ ".ssl.socketFactory.fallback", "false");
} else if (acct.iIncomingHostEncryption == Constants.ENCRYPT_SSL) {
Log.i(TAG, "Enable SSL...");
props.put("mail." + sProtocol + ".ssl.enable", "true");
}
it is working for gmail / yahoo account. I think the properties set need to be changed . Please help me to solve this.
I am getting 09-30 15:09:25.249: W/System.err(1095): idg.javax.mail.AuthenticationFailedException: [AUTHENTICATIONFAILED] Authentication failed 09-30 15:09:25.249: W/System.err(1095): at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:663)
My credential are correct because mail is send successfully to this account using smtp . Getting this checking incoming host
it worked with the following properties
props.put("mail." + sProtocol + ".starttls.enable", "true");
props.setProperty("mail." + sProtocol + ".ssl.trust", "*");
props.setProperty("mail." + sProtocol
+ ".ssl.socketFactory.class",
"com.myproject.MySSLSocketFactory");
props.setProperty("mail." + sProtocol
+ ".ssl.socketFactory.fallback", "false");