I need my web application to send thousands of per day. Currently, on being triggered by front-end user, i run a for loop in back-end which send mails.
Read this: How can I send an email by Java application using GMail, Yahoo, or Hotmail?
Issues:
If someone closes the web page after sending request, request is incomplete.
It takes long time to send email and user has to wait.
Ideally, i would like to save the email and content in database from where scheduler picks up the job and send email and notify the user once mail is sent/any issue occurs.
How can i achieve this? Will cron jobs help here? What if application is deployed on windows server? Or shall i write a separate java application to pick up the tasks from database and send mail? Can i schedule a job in web application?