I have a data source with thousand of mails, what i need to do, its send this mail in a loop, but when a mail is blacklisted or invalid i receive an error and the others mails never are sent.
This is important because the later contacts never receive my flyers, its possible to ignore the failed mail and still going with the sending?
This is part of my code:
DataView dv = (DataView)contactosSource.Select(DataSourceSelectArguments.Empty);
for (int i = 0; i < dv.Count; i++)
{
string correo = "" + dv[i][0];
MailMessage m = new MailMessage();
SmtpClient sc = new SmtpClient();
m.From = new MailAddress("carlos.ancona@dotstudio.com", "Carlos Ancona");
m.To.Add(new MailAddress(correo, correo));
m.Subject = subjectLabel.Text;
m.Body = "This is a Test Mail";
String username = "SMTPusername";
String password = "password";
sc.Host = "email-smtp.us-east-1.amazonaws.com";
sc.Port = 587;
sc.Credentials = new System.Net.NetworkCredential(username, password);
//sc.UseDefaultCredentials = true;
sc.EnableSsl = true;
sc.DeliveryMethod = SmtpDeliveryMethod.Network;
sc.Send(m);
}
1 Answer