Reputation: 21
I created a mvc web project. Now it is working on IIS. I want to do auto-mail service. Sql table has "targetDate, eMail, topicTxt" (DateTime). Programming logic is:
if targetDate has passed send alert email with topicTxt to eMail
I did that inside controller. But it isn't working if no one isn't online.
I'm searching that:
Even if there are no people online, Scan the information in the database and If the required conditions are met: send e-mails
Can you sugget something about this issue.
Upvotes: 1
Views: 533
Reputation: 218722
Instead of doing that in the Web app, You should probably write a windows service which runs all the time. Inside the service you can periodically( You can setup a timer which fires on a regular interval( Ex: every 5 minutes)) check your condition and do emailing part.
Here is a link to get started. https://msdn.microsoft.com/en-us/library/zt39148a(v=vs.110).aspx
Upvotes: 2