Asynchronous e-mail processing in Java Web Applications
When a user registers for a new account, I want to implement asynchronous email sending in my web application This means that if there is a problem or delay in sending e-mail messages (for example, the mail server is down or the network connection to the mail server is slow), users will not wait for the sending to complete
My web application is built using the JPA implementation of spring and hibernate
What is the best and most reliable way to implement asynchronous e-mail processing in this web application?
I'm considering saving the database information in the database table, and then quartz( http://www.opensymphony.com/quartz/ )The scheduled job polls for updates periodically and tries to send new unsent emails when it finds them
Is this a reasonable way to achieve what I want?
thank you.
Edit:
The most responsive response is to send mail as a synchronous call, but I think the best reason for the asynchronous method is that I am currently using Gmail as my outbound mail server (this is used for development testing) and my response is delayed by 25 seconds when my application attempts to send email to the call return of the mail sending function What's your opinion?
resolvent
Solution
I advise you not to disturb me Most UNIX style MTAS invented and perfected delayed transmission decades ago. You shouldn't reinvent the wheel You will do badly (compared with sendmail or postfix) and you will miss something My best suggestion is to use java mail APIs javax Mail and let the MTA handle the asynchronous part@ H_ 404_ 16@ @H_ 404_ 16@
The above is all the contents of asynchronous e-mail processing in Java Web applications collected and sorted by programming home. I hope this article can help you solve the program development problems encountered in asynchronous e-mail processing in Java Web applications.
If you think the content of the programming home website is good, you are welcome to recommend the programming home website to programmers and friends.