internal static MailWriter End(IAsyncResult result)
        {
            SendMailAsyncResult result2 = (SendMailAsyncResult)result;
            object obj2 = result2.InternalWaitForCompletion();

            if (obj2 is Exception)
            {
                throw ((Exception)obj2);
            }
            return(new MailWriter(result2.stream));
        }
Beispiel #2
0
        internal static MailWriter End(IAsyncResult result)
        {
            SendMailAsyncResult thisPtr = (SendMailAsyncResult)result;
            object sendMailResult       = thisPtr.InternalWaitForCompletion();

            // Note the difference between the singular and plural FailedRecipient exceptions.
            // Only fail immediately if we couldn't send to any recipients.
            if ((sendMailResult is Exception e) &&
                (!(sendMailResult is SmtpFailedRecipientException) ||
                 ((SmtpFailedRecipientException)sendMailResult).fatal))
            {
                ExceptionDispatchInfo.Throw(e);
            }

            return(new MailWriter(thisPtr._stream));
        }