System.Net.Mail.MailMessage.BeginSend C# (CSharp) Method

BeginSend() private method

private BeginSend ( System.Net.Mime.BaseWriter writer, bool sendEnvelope, bool allowUnicode, AsyncCallback callback, object state ) : IAsyncResult
writer System.Net.Mime.BaseWriter
sendEnvelope bool
allowUnicode bool
callback AsyncCallback
state object
return IAsyncResult
        internal IAsyncResult BeginSend(BaseWriter writer, bool sendEnvelope, bool allowUnicode,
            AsyncCallback callback, object state)
        {
            SetContent(allowUnicode);
            return _message.BeginSend(writer, sendEnvelope, allowUnicode, callback, state);
        }

Usage Example

Esempio n. 1
0
 void SendMailCallback(IAsyncResult result)
 {
     GlobalLog.Enter("SmtpClient#" + ValidationHelper.HashString(this) + "::SendMailCallback");
     try {
         writer = transport.EndSendMail(result);
         // If some recipients failed but not others, send the e-mail anyways, 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);
         GlobalLog.Leave("SmtpClient#" + ValidationHelper.HashString(this) + "::SendMailCallback");
         return;
     }
     try {
         if (cancelled)
         {
             Complete(null, result);
         }
         else
         {
             message.BeginSend(writer, DeliveryMethod != SmtpDeliveryMethod.Network,
                               ServerSupportsEai, new AsyncCallback(SendMessageCallback), result.AsyncState);
         }
     }
     catch (Exception e) {
         Complete(e, result);
     }
     GlobalLog.Leave("SmtpClient#" + ValidationHelper.HashString(this) + "::SendMailCallback");
 }
All Usage Examples Of System.Net.Mail.MailMessage::BeginSend