I am developing a web app a java/j2ee based web app. I am using amazon web 开发者_如何学Pythonservices simple emailing service api's to send emails and also I will be using it for sending bulk emails. Which is as same as Java Mail API. Now I am facing a challenge, but I need to implement this feature since all other web applications have already done it.
Once the new user register to our web app, after the successful registration we have to send him a mail confirmation the register.
What is the best practice to do it. To bring upon your notice its a Java/j2ee based application.
The question is too broad. But I'll try to throw one "best practice" into the ring.
Don't send e-mails directly from your web site - serving code. Make it write to some persistent storage, for example, a database table. And create a background process that would scan that table on a preset interval, say, every 5 minutes, detect any new records and send e-mails.
You would protect your web site code from any delays or crashes related to sending e-mails. Your application will always know where it left off when restarting after a crash or a system upgrade. You'll have an auditable record of e-mails sent.
精彩评论