check this tutorial:
Send Bulk (Mass) Email in ASP.Net using C# and VB.Net[
^]
it sends emails using parallel multi threading.
sample code:
Parallel.ForEach(dtCustomers.AsEnumerable(), row =>
{
SendEmail(row["Email"].ToString(), subject, string.Format(body, row["Name"]));
});
method:
private bool SendEmail(string recipient, string subject, string body)
{
bool isSuccess =false;
try{
MailMessage mm = new MailMessage("sender@gmail.com", recipient);
mm.Subject = subject;
mm.Body = body;
mm.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
NetworkCredential NetworkCred = new NetworkCredential();
NetworkCred.UserName = "sender@gmail.com";
NetworkCred.Password = "<password>";
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
isSuccess =true;
}catch(Exception ex)
{
}
return isSuccess ;
}