コード例 #1
0
        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));
        }
コード例 #2
0
ファイル: SmtpTransport.cs プロジェクト: rsumner31/corefx2
        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));
        }