.Net void multi-threading

I have a winforms app I inherited

In effect it opens with a task scheduler
Runs a sub (void) and closes

The SendMail void effectively sends 10,000 emails from a list it gets in SQL Server and send on to a providers smtp

That Provider allows 10,000 in a send....
But there can be multiple sends going on at the same time.

Is there a way to run the SendMail void in 5 separate "threads" so that 50k are being sent?

        SendMail(IsLive)
        Me.Close()
Larry Bristersr. DeveloperAsked:
Who is Participating?
 
Éric MoreauConnect With a Mentor Senior .Net ConsultantCommented:
you can wrap your code in a task and create 5 of them. Check http://emoreau.com/Entries/Articles/2013/10/SystemThreadingTask-class.aspx

but are you sure your provider will allow you to send 50,000 emails at the same time?
0
 
PawełI Design & Develop SoftwareCommented:
a task scheduler? what version of .net are you using?
0
 
Larry Bristersr. DeveloperAuthor Commented:
Eric,
  50,000 at the same time in a "timeframe"

Pawel
.Net 4.5
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Éric MoreauSenior .Net ConsultantCommented:
you can try to wrap your code in task as shown by my article and launch your tasks
0
 
Larry Bristersr. DeveloperAuthor Commented:
Very nice
0
 
Éric MoreauSenior .Net ConsultantCommented:
or just launch your job from the task scheduler 5 times with a parameter to process a different set of records in each instance
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.