private void SendMailFrom() { IAsyncResult result = MailCommand.BeginSend(_connection, SmtpCommands.Mail, _from, _allowUnicode, s_sendMailFromCompleted, this); if (!result.CompletedSynchronously) { return; } MailCommand.EndSend(result); SendToCollection(); }
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); } } }