Search code examples
javaemailsmtpjakarta-mail

javax.mail hangup - When specifying a valid ip, other than an SMTP server


I'm trying to create a mail sending util in java. It works fine when using a valid SMTP server as host. The issue is whenever someone specifies a valid IP other than SMTP server, it hangsup. How to resolve this issue? Is there a way set timeout in javax.mail other than using threads?


Solution

  • Set the mail.smtp.connectiontimeout property.