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