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

BuildDeliveryStatusNotificationString() private method

private BuildDeliveryStatusNotificationString ( ) : string
return string
        internal string BuildDeliveryStatusNotificationString()
        {
            if (_deliveryStatusNotification != DeliveryNotificationOptions.None)
            {
                StringBuilder s = new StringBuilder(" NOTIFY=");

                bool oneSet = false;

                //none
                if (_deliveryStatusNotification == DeliveryNotificationOptions.Never)
                {
                    s.Append("NEVER");
                    return s.ToString();
                }

                if ((((int)_deliveryStatusNotification) & (int)DeliveryNotificationOptions.OnSuccess) > 0)
                {
                    s.Append("SUCCESS");
                    oneSet = true;
                }
                if ((((int)_deliveryStatusNotification) & (int)DeliveryNotificationOptions.OnFailure) > 0)
                {
                    if (oneSet)
                    {
                        s.Append(",");
                    }
                    s.Append("FAILURE");
                    oneSet = true;
                }
                if ((((int)_deliveryStatusNotification) & (int)DeliveryNotificationOptions.Delay) > 0)
                {
                    if (oneSet)
                    {
                        s.Append(",");
                    }
                    s.Append("DELAY");
                }
                return s.ToString();
            }
            return string.Empty;
        }
    }

Usage Example

コード例 #1
0
ファイル: SmtpClient.cs プロジェクト: zadixon/corefx
 private void ConnectCallback(IAsyncResult result)
 {
     if (NetEventSource.IsEnabled)
     {
         NetEventSource.Enter(this);
     }
     try
     {
         _transport.EndGetConnection(result);
         if (_cancelled)
         {
             Complete(null, result);
         }
         else
         {
             // Detected durring Begin/EndGetConnection, restrictable using DeliveryFormat
             bool allowUnicode = IsUnicodeSupported();
             ValidateUnicodeRequirement(_message, _recipients, allowUnicode);
             _transport.BeginSendMail(_message.Sender ?? _message.From, _recipients,
                                      _message.BuildDeliveryStatusNotificationString(), allowUnicode,
                                      new AsyncCallback(SendMailCallback), result.AsyncState);
         }
     }
     catch (Exception e)
     {
         Complete(e, result);
     }
     finally
     {
         if (NetEventSource.IsEnabled)
         {
             NetEventSource.Exit(this);
         }
     }
 }
All Usage Examples Of System.Net.Mail.MailMessage::BuildDeliveryStatusNotificationString