I have an email mailout that loops though about 750 client records. The loop fails after about 50 or 100 emails
public static async Task<int> SendEmailList(List<AgencyUser> mailingList, string emailSubject, string emailbody)
{
int sentCount = 0;
bool emailSent = false;
foreach (AgencyUser thisClient in mailingList)
{
emailSent = (SendEmail(thisClient, emailSubject, emailbody));
//}
if (emailSent)
{
sentCount++;
}
}
await Task.Yield();
return sentCount;
}
This is the error returned by ELMAH
System.Threading.ThreadAbortException: Thread was being aborted. at Clients.Mailout.d__0.MoveNext() at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMach ...
Go to the complete details ...