System.Net.Mail.SmtpTransport.EndSendMail C# (CSharp) Method

EndSendMail() private method

private EndSendMail ( IAsyncResult result ) : System.Net.Mail.MailWriter
result IAsyncResult
return System.Net.Mail.MailWriter
        internal MailWriter EndSendMail(IAsyncResult result)
        {
            try
            {
                return SendMailAsyncResult.End(result);
            }
            finally
            {
            }
        }

Usage Example

Example #1
0
        private void SendMailCallback(IAsyncResult result)
        {
            try
            {
                _writer = _transport.EndSendMail(result);
                // If some recipients failed but not others, send the e-mail anyway, but then return the
                // "Non-fatal" exception reporting the failures.  The sync code path does it this way.
                // Fatal exceptions would have thrown above at transport.EndSendMail(...)
                SendMailAsyncResult sendResult = (SendMailAsyncResult)result;
                // Save these and throw them later in SendMessageCallback, after the message has sent.
                _failedRecipientException = sendResult.GetFailedRecipientException();
            }
            catch (Exception e)
            {
                Complete(e, result);
                return;
            }

            try
            {
                if (_cancelled)
                {
                    Complete(null, result);
                }
                else
                {
                    _message !.BeginSend(_writer, DeliveryMethod != SmtpDeliveryMethod.Network,
                                         IsUnicodeSupported(), new AsyncCallback(SendMessageCallback), result.AsyncState !);
                }
            }
            catch (Exception e)
            {
                Complete(e, result);
            }
        }
All Usage Examples Of System.Net.Mail.SmtpTransport::EndSendMail