.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 MoreauSenior .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
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
É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.