Home > other >  Email schedule that runs in the background in ASP.NET MVC
Email schedule that runs in the background in ASP.NET MVC

Time:05-17

How to create an email that run in the background as long as there is a timeout > 2 between 2 dates.

2 days the difference between the 2 dates otherwise there is a time overrun as in the photo (opening date1, closing date2 : date2 -date1 > 2 => mail)

Image

CodePudding user response:

You can follow below steps:

  1. Create a background SQLAgent job, which runs on regular schedule, say daily once or every 12 hours, based on the notification schedule.
  2. This SQLAgent job, polls the schedule table and sends email using sp_send_dbmail. Use DATEDIFF(day,GETDATE(),TravelDate) < 2 to find out the travels within 2 days. send email using sp_send_dbmail
  • Related