4
J'essaie de lire les courriels dans un dossier d'un compte de messagerie Office365 en utilisant JavaMail 1.4 api.IMAP accès au bureau de poste 365 avec javamail
Mon code est:
public static void main(String argv[]) throws Exception {
// Get a Properties object
Properties props = System.getProperties();
// Get a Session object
Session session = Session.getInstance(props, null);
// Get a Store object
Store store = null;
Folder rf = null;
if (CUR_MAIL_PROTOCOL != null)
store = session.getStore("imap");
// Connect
if (CUR_MAIL_HOST != null || CUR_MAIL_LOGIN != null || CUR_MAIL_PWD != null)
store.connect("outlook.office365.com", 993, "**MYEMAIL**", "**MYPASS**");
else
store.connect();
// List namespace
rf = store.getDefaultFolder();
getFolderDetails(rf, true, "");
if ((rf.getType() & Folder.HOLDS_FOLDERS) != 0) {
Folder[] f = rf.list("%");
for (int i = 0; i < f.length; i++)
getFolderDetails(f[i], recursive, " ");
}
store.close();
}
Mon erreur est:
Exception in thread "main" javax.mail.MessagingException: Connection timed out: connect;
nested exception is:
java.net.ConnectException: Connection timed out: connect
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:298)
at javax.mail.Service.connect(Service.java:234)
Merci
PS: Compte Office365 en utilisant JavaMail 1.4 api
La FAQ a JavaMail [conseils pour le débogage des problèmes de connexion] (http://www.oracle.com/technetwork/java/javamail/faq/index.html#condebug). –
ok: D Maintenant, j'ai cette erreur: DEBUG: GetProvider() retour javax.mail.Provider [MAGASIN, imap, com.sun.mail.imap.IMAPStore, Sun Microsystems, Inc] * OK Microsoft Le service IMAP4 d'Exchange est prêt. [QQBNADMAUABSADAANQBDAEEAMAAyADEALgBlAHUAcgBwAHIAZAAwADUALgBwAHIAbwBkAC4AbwB1AHQAbABvAG8AawAuAGMAbwBtAA ==] A0 CAPACITES * CAPACITES IMAP4rev1 LOGINDISABLED STARTTLS IMAP4 SASL-IR UIDPLUS DEPLACER ID DECOCHER ENFANTS IDLE NAMESPACE LITERAL + A0 OK CAPACITES terminée. A1 LOGIN [email protected] ***** A1 Commande BAD reçue à l'état Invalide. – Marin
Basic l'erreur est: LOGIN A1 BAD Commande reçue dans l'état Invalid. – Marin