Java Mail defines the properties:
mail.smtp.writetimeout - Socket write timeout value in milliseconds. This timeout is implemented by using a java.util.concurrent.ScheduledExecutorService per connection that schedules a thread to close the socket if the timeout expires. Thus, the overhead of using this timeout is one thread per connection. Default is infinite timeout.
To ensure a send times out if the mail server isn't responding, allow this to be configured, with a default of 2 minutes.