Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 62
  • Last Modified:

.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()
0
lrbrister
Asked:
lrbrister
  • 3
  • 2
1 Solution
 
É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łSharePoint DeveloperCommented:
a task scheduler? what version of .net are you using?
0
 
lrbristerAuthor Commented:
Eric,
  50,000 at the same time in a "timeframe"

Pawel
.Net 4.5
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Éric MoreauSenior .Net ConsultantCommented:
you can try to wrap your code in task as shown by my article and launch your tasks
0
 
lrbristerAuthor 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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now