0
votes

I got following error with java mail on windows server 2008 R2 and 25 port is enabled on my firewalls inbound rule:

DEBUG SMTP: trying to connect to host "XXX.XXX.XXX", port 25, isSSL false javax.mail.MessagingException: Could not connect to SMTP host: XXX.XXX.XXX, port: 25; nested exception is: java.net.ConnectException: Connection timed out: connect at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1706) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:525) at javax.mail.Service.connect(Service.java:313) at javax.mail.Service.connect(Service.java:172) at javax.mail.Service.connect(Service.java:121) at javax.mail.Transport.send0(Transport.java:190) at javax.mail.Transport.send(Transport.java:120)

Please help!!

1

1 Answers

1
votes

Get the actual SMTP session debug text by setting the mail.smtp.debug property to true. You can either read the debug output from the command prompt or set it to output to a file.

Check if your method of authentication is allowed. After it says AUTH it should have the permitted authentication options (GSSAPI, DIGEST-MD5, PLAIN, LOGIN).

If it doesn't get to AUTH you might be using the wrong port. Usually:

  • 25 for SMTP
  • 465 for SSL
  • 587 for TLS

If you post the debug output, we can probably offer some more tips.