troubleshooting Question

Email Throttling

Avatar of mrperfect75000
mrperfect75000Flag for United States of America asked on
.NET ProgrammingC#ASP.NET
1 Comment1 Solution675 ViewsLast Modified:
Hi guys,

I'm working on an email program to send emails to my customers...However I would like to send those emails at intervals - like every 30 seconds...This is my code but i'm not sure how to handle the time elapsed.

I dont want to call my whole email function on time elapsed i just want client.send to be called every 30 seconds because its in a while loop....

 while (reader.Read())
                     {
                         mail.Body = body;
                         mail.IsBodyHtml = true;
                         SmtpClient client = new SmtpClient("myclient.com");
                         client.UseDefaultCredentials = true;

                         Timer mytimer = new Timer();
                         mytimer.Interval = 30000;
                         mytimer.Enabled = true;
                         mytimer.Elapsed += client.Send(mail);  // this wont work but i'm not sure what will
                         mytimer.AutoReset = true;


}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros