I'm using the System.Net.Mail interfaces to send emails; however, if I am sending to a list of emails and one of them does not exist, the entire message is aborted and an exception is thrown. Is there a way to tell the Client to not throw an exception on a failed message and to sent to the rest of the recipients
Thanks,
Kevin

System.Net.Mail -- how to continue sending to emails if one of the emails fails with a 511
rokohl
static string Host = "";
public static void SendList(MailMessage[] List)
{
bool[] ListErrors = new bool[List.Length];
bool AllTrue = true;
for (int I = 0; I < List.Length; I++)
ListErrors
for (int I = 0; I < ListErrors.Length; I++ )
if (ListErrors
AllTrue = false;
if (AllTrue)
Console.WriteLine("All messages were sent.");
else
{
Console.Write("Not all messages were sent, messages not sent are:");
for (int I = 0; I < ListErrors.Length; I++)
if (ListErrors
Console.Write(" " + I.ToString + ".");
}
}
public static bool SendMail(MailMessage TheMessage)
{
SmtpClient Send = new SmtpClient(Host, 25);
try
{
Send.Send(TheMessage);
}
catch (Exception)
{
return false;
}
finally
{
return true;
}
}
Simple ;)