這裏有幾篇文章,但其中沒有一篇適合我。基本上我有以下java代碼連接到辦公室365:如何使用Java應用程序中的IMAPS協議連接到office365
Properties props = new Properties();
props.put("mail.imaps.auth.plain.disable", "true");
props.put("mail.imaps.ssl.enable", "true");
session = Session.getInstance(props, null);
store = session.getStore("imaps");
store.connect("outlook.office365.com", 993, "[email protected]", "psw");
但它失敗,LOGIN失敗的錯誤;
javax.mail.AuthenticationFailedException: LOGIN failed.
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:725)
at javax.mail.Service.connect(Service.java:366)
此外,我可以使用Thunderbird的IMAPS登錄我的帳戶。
任何解決問題的指針,將不勝感激!
哎呀,你已經有了域:d –
謝謝回答,但這沒有幫助。連接被拒絕,同一個LOGIN失敗的異常。還確保我們的Office 365服務器上啓用了IMAPS訪問協議。 – Delorean