在其他答复的帮助下,我提出了以下解决办法: comsun.mail:javax.mail:1.6.2
Properties props = new Properties();
props.setProperty("mail.imaps.auth.mechanisms", "LOGIN");
Session session = Session.getInstance(props);
Store store = session.getStore("imaps");
store.connect("outlook.office365.com", 993, "[email protected]\shared_account_alias", "user_password");
电子邮件:1.4.7 遵循法典:
Properties props = new Properties();
props.setProperty("mail.imaps.auth.plain.disable", "true");
Session session = Session.getInstance(props);
Store store = session.getStore("imaps");
store.connect("outlook.office365.com", 993, "[email protected]\shared_account_alias", "user_password");
共享——账户是NOT的电子邮件地址。
最后,我找到了使用共用邮件箱的更标准的方法:
Properties props = new Properties();
props.setProperty("mail.imaps.sasl.enable", "true");
props.setProperty("mail.imaps.sasl.authorizationid", "shared_account_alias");
Session session = Session.getInstance(props);
Store store = session.getStore("imaps");
store.connect("outlook.office365.com", 993, "[email protected]", "user_password");