Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send emails in background job/scheduled task in asp.net mvc 3

I have an ASP.NET MVC 3 web app hosted on normal hosting, (i.e., no owned or virtual server), and I would like to be able to store e-mails say in a database and have them picked up and sent in a background job of sorts.

If this was my own server I'd write a Windows Service to handle this, but is there any way I could implement/simulate a scheduled task/background job in a web application process?

like image 323
Sergi Papaseit Avatar asked Mar 01 '11 20:03

Sergi Papaseit


3 Answers

You may take a look at Quartz.NET. There is a blog post about how you could make it running in medium trust.

like image 54
Darin Dimitrov Avatar answered Oct 28 '22 20:10

Darin Dimitrov


You can take a look at this post (https://blog.stackoverflow.com/2008/07/easy-background-tasks-in-aspnet/) which explains on how run scheduled tasks without using windows service, in asp.net or asp.net mvc.

like image 44
sarvesh Avatar answered Oct 28 '22 22:10

sarvesh


You can also use job cash:

 HttpContext.Current.Cache.Add("jobkey",  
                         "jobvalue", null,  
                         DateTime.MaxValue,  
                         TimeSpan.FromSeconds(15), // set the time interval  
                         CacheItemPriority.Default, JobCacheRemoved); 

For Details See this

like image 22
Mohammad Atiour Islam Avatar answered Oct 28 '22 20:10

Mohammad Atiour Islam