I am sending emails using c# using SmtpClient. I have to send aproximately one hundred different emails per day, and I can't use the same mail (adding several recipients) since the email changes according to the recipient.
I am not using a local SMTP server, and I understand (according to @rizzle response here) that some time has to be left between one mail and another one. However, I am sleeping my program for 10 seconds and still, it is only the first email that gets sent, never the second one (so far I am trying my system with two emails instead of one hundred). This is my code, any ideas?
foreach (Person p in clientList)
{
AlternateView plainView = AlternateView.CreateAlternateViewFromString("Texto visible para clientes que no tienen HTML", null, "text/plain");
//AlternateView htmlView = AlternateView.CreateAlternateViewFromString("Here is an embedded image.<img src=cid:companylogo>", null, "text/html");
string htmlString = "html string body of the email";
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(htmlString, null, "text/html");
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.AlternateViews.Add(htmlView);
message.To.Add(p.email.Trim());
message.Subject = p.nombre+", email subject";
message.From = new System.Net.Mail.MailAddress(fromAddress);
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("...");
NetworkCredential myCreds = new NetworkCredential(usr, pass, "");
client.Credentials = myCreds;
client.Send(message);
System.Threading.Thread.Sleep(10000);
}