I have the following code which sends out a batch of emails to our list of recipients every 60 seconds. What I'm not sure how to do is get to the completed part of the thread so that when it's done I can record the final status of how many emails were sent. Is this possible in a lambda style thread or do I have to do something else? thanks.
(new Thread(()=>
{
message.To.Clear();
var emailsToSend = memberlist.Skip(currentCount).Take(takeCount).ToList();
foreach (var email in emailsToSend)
{
message.To.Add(new MailAddress(email.Email));
//for logging purposes
campaign.SentTo.Add(new BroadcastEmailCampaignSentTo
{
MemberId = email.MemberId,
Email = email.Email,
DateSent = DateTime.Now
});
}
})).Start(pauseTime);