0

In my MVC application, I have this scenario. At the 25th of every month, certain users has to be fetched from the database and an email should be sent to them as alert. I am currently using mvcmailer in the project to send mail but a request has to be made.

What would be the best approach to getting mail sent automatically on the 25?

1 Answers1

0

as you have stated, the web stack is a poor place for doing automated jobs as it is a request/response stack and not a wake up and do something task.

You have several options:

  1. Use a task schedule on the server and fire of a web request to your mail controller
  2. Use a windows service that wakes up on the 25th to do the work by making a web request to your mail controller
  3. Use a windows service that wakes up on the 25th and does the email sending itself.

personally, I would take option 3, it means it isn't reliant on the web server being up to do its work.

I would look at using Quartz.net to do the job scheduling and probably something like windows workflow to do the mailing selection and sending, but that part can easily be a copy of your mail controller logic

Slicksim
  • 7,054
  • 28
  • 32