I am trying out a small application using Javamail. I have setup property "mail.smtp.host" to the smtp server using which i am able to send emails. So the server address is valid and the server is running. But still i am getting this exception as : -
javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: Could not connect to SMTP host: < nested exception is:
java.net.SocketException: Operation timed out: connect:could be due to invalid address
I am behind a firewall. Will it matter anyway?
Have you tried a telnet to your server
i.e. telnet [smtphost] 25
if it connects type HELO and you should get a response.
if you cannot connect then the problem is not with your software.
Ian PurtonWebsite Uptime and Availability
| Permission Email List Management
| Smartphone GPS
| All Time Top 100 Rock Charts
If the mailserver is on the otherside of the FW you may not be able telnet to 25. A FW may restrict telnet. If not, try using the IP address of the mailserver. It may be a DNS or local network configuration issue.
Can you ping by name & IP?
The above two suggestions will be useful if you were to set the debugging on in your code, and then follow through to the point where the exception is raised. In verbose mode, the javamail program that you write will print out each request and response provided. This is the best way to figure out where it goofs up :-).