简体   繁体   中英

sending email notifications to the new user using Java mail API

I am developing a web app a java/j2ee based web app. I am using amazon web services 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM