Anand MR

Anand MR

  • NA
  • 39
  • 19.9k

SMTP sever

Jul 22 2015 3:43 AM
Hi friends,
                    Here is my code for sending mail to Multiple users at a time.Its working fine.
But for example in multiple user's email id's any one is invalid ,in this case mail is not send to the rest of the valid email also.
 
My expectation is  mail should send if there is valid email id's in the To address even any one of the email id is invalid.
 
Please give me the solution for this as soon as possible friends. 
 
 
SmtpClient client = new SmtpClient(); //SMTP Client to Configure & Send email
client.Host = "";
client.Port = "";
client.Credentials = new System.Net.NetworkCredential("", "");
client.EnableSsl = false;
email.Subject = dsInitialdata.Tables[1].Rows[0]["EMAIL_SNT_MSG_SUBJ_TXT"].ToString();
if (toArray != null && toArray.Length > 0)
{
foreach (string toId in toArray)
{
if (toId.Trim() != String.Empty)
{
email.To.Add(toId);
}
}
}
email.IsBodyHtml = true;
MailAddress from = new MailAddress("[email protected]","Welcome");
client.Send(email);
 
 

Answers (8)