下面的代码是 Web 应用程序的一部分。这负责连接 Outlook 邮件服务器。
ls_user_pass = ldch_sys_users.getItemValue(1, "user_password").toString();
Store store = null;
String lstr_host = "",lstr_result= "no";
HttpSession lssessionUserAuth = (HttpSession) ahm_args.get("session");
try {
Properties properties = new Properties();
properties.setProperty("mail.store.protocol", "imaps");
Session session = Session.getInstance(properties, null);
lstr_host = "outlook.office365.com";
store = session.getStore("imaps");
store.connect(lstr_host, "rajesh___@outlook.com", ls_user_pass);
if (store.isConnected()) {
lstr_result = "yes";
}
}catch(AuthenticationFailedException e){
}
return lstr_result;
}
当我在服务器上部署战争时,我收到此错误 javax.mail.messagingexception 连接超时连接。我已经打开了几个端口 587,143,25 并且服务器上的防火墙已关闭。
但是当我在本地系统上通过 Eclipse 工作时,它工作正常,没有任何问题。