When running my application locally, I have no problem in sending mail through my application. But when I upload the same application on server and run from there, I get the following exception:
Can someone tell me why I am getting this exception?
"Running the app locally" means running the application on local IP and "check it online" means after uploading it on the server. In the first case, my application connects to my mail server successfully, but in the second case, it does not connect to my mail server and javax.mail.MessagingException is thrown. Any idea please?
Is it possible to know whether the mail server and its port 25 are reachable from the server I am running the code from? If yes, then how and how can I solve this problem?
You could try telneting to it. Its not a fool proof way to do it but usually if you can telnet to your SMTP server you can connect to it via Java Mail.
However, the best way to avoid these configuration headaches is to speak to your network administrator.