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?
Set the mail.smtp.connectiontimeout
property.