Reputation: 57
Below code is the part of the web application. This is responsible to connect with outlook mail server.
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, "[email protected]", ls_user_pass);
if (store.isConnected()) {
lstr_result = "yes";
}
}catch(AuthenticationFailedException e){
}
return lstr_result;
}
when I deployed war on server , I am getting this error javax.mail.messagingexception connection timed out connect. Already I have opened few port 587,143,25 and on server firewall is off.
But when I work through eclipse on local system, it working fine, without any problem.
Upvotes: 0
Views: 5136
Reputation: 11
It still seems a firewall / network issue. If you are sending the mail from local, you can check the stream / port/ etc. with WireShark for example, after that you can check the firewall conf again for the server.
You can also try to set the port by hand: properties.put("mail.smtp.port", "587"); // "587" should be a string, if not port 25 will be used
For further going, please write down the result of the check.
Upvotes: 1