title: Asynchronous email processing in Java web application
body: <p>I would like to implement asynchronous email sending in my web application when users register for a new account. This is so that if there is a problem or delay in sending the email message (e.g. the mail server is down or the network connection to the mail server is slow) the user won't be kept waiting for the sending to complete.</p>
  
  <p>My web app is built using Spring and Hibernate's implementation of JPA.</p>
  
  <p>What would be the best and most reliable way for me to implement asynchronous email processing in this web application?</p>
  
  <p>I am thinking about persisting the email information in a database table which is then regularly polled by a Quartz (<a href="http://www.opensymphony.com/quartz/" rel="nofollow noreferrer">http://www.opensymphony.com/quartz/</a>) scheduled job for updates and when it finds new unsent emails, it attempts to send them.</p>
  
  <p>Is this a reasonable way of implementing what I want?</p>
  
  <p>Thanks.</p>
  
  <p>Edit:</p>
  
  <p>The most voted on response is to leave the sending of mail as a synchronous call but what's triggered my thinking that an asynchronous approach might be best is that I'm currently using GMail as my outbound mail server (this is for testing while developing) and I'm experiencing a 25 second delay in response from when my app tries to send the email to when the call to the mail send function returns. What do you think?</p>