private static void SendMailFromCompleted(IAsyncResult result)
{
if (!result.CompletedSynchronously)
{
SendMailAsyncResult thisPtr = (SendMailAsyncResult)result.AsyncState;
try
{
MailCommand.EndSend(result);
thisPtr.SendToCollection();
}
catch (Exception e)
{
thisPtr.InvokeCallback(e);
}
}
}