System.Net.Mail.SendMailAsyncResult.SendDataCompleted C# (CSharp) Method

SendDataCompleted() private static method

private static SendDataCompleted ( IAsyncResult result ) : void
result IAsyncResult
return void
        private static void SendDataCompleted(IAsyncResult result)
        {
            if (!result.CompletedSynchronously)
            {
                SendMailAsyncResult thisPtr = (SendMailAsyncResult)result.AsyncState;
                try
                {
                    DataCommand.EndSend(result);
                    thisPtr._stream = thisPtr._connection.GetClosableStream();
                    if (thisPtr._failedRecipientExceptions.Count > 1)
                    {
                        thisPtr.InvokeCallback(new SmtpFailedRecipientsException(thisPtr._failedRecipientExceptions, thisPtr._failedRecipientExceptions.Count == thisPtr._toCollection.Count));
                    }
                    else if (thisPtr._failedRecipientExceptions.Count == 1)
                    {
                        thisPtr.InvokeCallback(thisPtr._failedRecipientExceptions[0]);
                    }
                    else
                    {
                        thisPtr.InvokeCallback();
                    }
                }
                catch (Exception e)
                {
                    thisPtr.InvokeCallback(e);
                }
            }
        }