0
I am developing an ASP.Net MVC application and want to create a thread to send emails every 30 seconds. I need this, because my provider does not allow the sending of many emails at msm time, so I thought to create a List<String>
to add emails and this List
is read in a foreach
and receives a Thread.sleep(30000)
30 seconds to send the next email, so I believe it would solve my problem.
How to do this, how to create Threads in Asp.Net MVC ?
Use Hangfire, see my reply https://answall.com/a/258607/5846
– Pablo Tondolo de Vargas
@Pablotondolodevargas I will test.
– FernandoPaiva
@Pablotondolodevargas needs to have Sqlserver installed ?
– FernandoPaiva
There is an extension that enables Hangfire only in memory (https://stackoverflow.com/a/43207027/2221388), however I have never used.
– Pablo Tondolo de Vargas
@Pablotondolodevargas where I put the call to execute the method ? I am putting in the
Startup.cs
but it doesn’t work. I’m trying like this:BackgroundJob.Schedule(() => Debug.WriteLine("Hello, world"), TimeSpan.FromSeconds(1));
There to run this Hello World every 1 second.– FernandoPaiva