title: Help when SMTP server hangs when sending emails from Java
body: <p>I use an external mail server to send SMTP mails, this server is effectively beyond my control. </p>
  
  <p>A couple of times recently this mail server has had issues and it's caused my Java (Struts/Spring) app to completely hang when waiting for a reply from the mail server.</p>
  
  <p>I'm using the Spring <strong>org.springframework.mail.javamail.JavaMailSender</strong> to send mails.</p>
  
  <p>When the external mail server is having issues it's the following line that freezes <strong>mailEngine.send(mailMessage);</strong></p>
  
  <p>I don't mind that sometimes emails don't get sent but how can I stop this from freezing my application while it waits for a reply from the SMTP server?</p>
  
  <p>Are there any good email queuing solutions for Java?</p>