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