SmtpFailedRecipientsException 클래스

정의

SmtpClient를 사용하여 보낸 이메일을 받는 사람 중 일부에게 배달할 수 없을 때 throw되는 예외입니다.

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

public ref class SmtpFailedRecipientsException : System::Net::Mail::SmtpFailedRecipientException
public class SmtpFailedRecipientsException : System.Net.Mail.SmtpFailedRecipientException
[System.Serializable]
public class SmtpFailedRecipientsException : System.Net.Mail.SmtpFailedRecipientException
type SmtpFailedRecipientsException = class
    inherit SmtpFailedRecipientException
    interface ISerializable
[<System.Serializable>]
type SmtpFailedRecipientsException = class
    inherit SmtpFailedRecipientException
    interface ISerializable
Public Class SmtpFailedRecipientsException
Inherits SmtpFailedRecipientException
상속
특성
구현

예제

다음 코드 예제에서는 사서함이 사용 중이거나 사용할 수 없어 배달되지 않은 전자 메일 메시지를 다시 보냅니다.

static void RetryIfBusy( String^ server )
{
   MailAddress^ from = gcnew MailAddress( L"ben@contoso.com" );
   MailAddress^ to = gcnew MailAddress( L"jane@contoso.com" );
   MailMessage^ message = gcnew MailMessage( from,to );
   
   // message.Subject = "Using the SmtpClient class.";
   message->Subject = L"Using the SmtpClient class.";
   message->Body = L"Using this feature, you can send an email message from an application very easily.";
   
   // Add a carbon copy recipient.
   MailAddress^ copy = gcnew MailAddress( L"Notifications@contoso.com" );
   message->CC->Add( copy );
   SmtpClient^ client = gcnew SmtpClient( server );
   
   // Include credentials if the server requires them.
   client->Credentials = dynamic_cast<ICredentialsByHost^>(CredentialCache::DefaultNetworkCredentials);
   Console::WriteLine( L"Sending an email message to {0} using the SMTP host {1}.", to->Address, client->Host );
   try
   {
      client->Send( message );
   }
   catch ( SmtpFailedRecipientsException^ ex ) 
   {
      for ( int i = 0; i < ex->InnerExceptions->Length; i++ )
      {
         SmtpStatusCode status = ex->InnerExceptions[ i ]->StatusCode;
         if ( status == SmtpStatusCode::MailboxBusy || status == SmtpStatusCode::MailboxUnavailable )
         {
            Console::WriteLine( L"Delivery failed - retrying in 5 seconds." );
            System::Threading::Thread::Sleep( 5000 );
            client->Send( message );
         }
         else
         {
            Console::WriteLine( L"Failed to deliver message to {0}", ex->InnerExceptions[ i ] );
         }

      }
   }
   catch ( Exception^ ex )
   {
       Console::WriteLine(L"Exception caught in RetryIfBusy(): {0}", 
                     ex->ToString() );
   }
   finally
   {
      client->~SmtpClient();
   }
}
public static void RetryIfBusy(string server)
{
    MailAddress from = new MailAddress("ben@contoso.com");
    MailAddress to = new MailAddress("jane@contoso.com");
    MailMessage message = new MailMessage(from, to);
    // message.Subject = "Using the SmtpClient class.";
    message.Subject = "Using the SmtpClient class.";
    message.Body = @"Using this feature, you can send an email message from an application very easily.";
    // Add a carbon copy recipient.
    MailAddress copy = new MailAddress("Notifications@contoso.com");
    message.CC.Add(copy);
    SmtpClient client = new SmtpClient(server);
    // Include credentials if the server requires them.
    client.Credentials = (ICredentialsByHost)CredentialCache.DefaultNetworkCredentials;
    Console.WriteLine("Sending an email message to {0} using the SMTP host {1}.",
         to.Address, client.Host);
    try
    {
        client.Send(message);
    }
    catch (SmtpFailedRecipientsException ex)
    {
        for (int i = 0; i < ex.InnerExceptions.Length; i++)
        {
            SmtpStatusCode status = ex.InnerExceptions[i].StatusCode;
            if (status == SmtpStatusCode.MailboxBusy ||
                status == SmtpStatusCode.MailboxUnavailable)
            {
                Console.WriteLine("Delivery failed - retrying in 5 seconds.");
                System.Threading.Thread.Sleep(5000);
                client.Send(message);
            }
            else
            {
                Console.WriteLine("Failed to deliver message to {0}",
                    ex.InnerExceptions[i].FailedRecipient);
            }
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine("Exception caught in RetryIfBusy(): {0}",
                ex.ToString() );
    }
}

설명

이 속성에는 InnerExceptions 전자 메일을 보내려고 시도하는 동안 수신된 예외가 포함됩니다. 전자 메일이 일부 받는 사람에게 성공적으로 배달되었을 수 있습니다.

생성자

SmtpFailedRecipientsException()

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

SmtpFailedRecipientsException 클래스의 빈 인스턴스를 초기화합니다.

SmtpFailedRecipientsException(SerializationInfo, StreamingContext)

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

SmtpFailedRecipientsExceptionSerializationInfo 클래스에 지정된 인스턴스에서 StreamingContext 클래스의 새 인스턴스를 초기화합니다.

SmtpFailedRecipientsException(String)

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

지정된 SmtpFailedRecipientsException를 사용하여 String 클래스의 새 인스턴스를 초기화합니다.

SmtpFailedRecipientsException(String, Exception)

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

지정된 SmtpFailedRecipientsException과 내부 String을 사용하여 Exception 클래스의 새 인스턴스를 초기화합니다.

SmtpFailedRecipientsException(String, SmtpFailedRecipientException[])

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

지정된 SmtpFailedRecipientsExceptionString 형식의 배열을 사용하여 SmtpFailedRecipientException 클래스의 새 인스턴스를 초기화합니다.

속성

Data

예외에 대한 사용자 정의 정보를 추가로 제공하는 키/값 쌍 컬렉션을 가져옵니다.

(다음에서 상속됨 Exception)
FailedRecipient

배달 문제가 있는 이메일 주소를 나타냅니다.

(다음에서 상속됨 SmtpFailedRecipientException)
HelpLink

이 예외와 연결된 도움말 파일에 대한 링크를 가져오거나 설정합니다.

(다음에서 상속됨 Exception)
HResult

특정 예외에 할당된 코드화된 숫자 값인 HRESULT를 가져오거나 설정합니다.

(다음에서 상속됨 Exception)
InnerException

현재 예외를 발생시킨 Exception 인스턴스를 가져옵니다.

(다음에서 상속됨 Exception)
InnerExceptions

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

SMTP 배달 오류가 발생한 이메일 받는 사람을 나타내는 SmtpFailedRecipientException을 하나 이상 가져옵니다.

Message

현재 예외를 설명하는 메시지를 가져옵니다.

(다음에서 상속됨 Exception)
Source

오류를 발생시키는 애플리케이션 또는 개체의 이름을 가져오거나 설정합니다.

(다음에서 상속됨 Exception)
StackTrace

호출 스택의 직접 실행 프레임 문자열 표현을 가져옵니다.

(다음에서 상속됨 Exception)
StatusCode

이메일 메시지가 전송될 때 SMTP 서버에서 반환된 상태 코드를 가져옵니다.

(다음에서 상속됨 SmtpException)
TargetSite

현재 예외를 throw하는 메서드를 가져옵니다.

(다음에서 상속됨 Exception)

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetBaseException()

파생 클래스에서 재정의된 경우 하나 이상의 후속 예외의 근본 원인이 되는 Exception 을 반환합니다.

(다음에서 상속됨 Exception)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetObjectData(SerializationInfo, StreamingContext)

SerializationInfo을 serialize하는 데 필요한 데이터로 SmtpFailedRecipientsException 인스턴스를 채웁니다.

GetType()

현재 인스턴스의 런타임 형식을 가져옵니다.

(다음에서 상속됨 Exception)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 예외에 대한 문자열 표현을 만들고 반환합니다.

(다음에서 상속됨 Exception)

이벤트

SerializeObjectState
사용되지 않습니다.

예외에 대한 serialize된 데이터가 들어 있는 예외 상태 개체가 만들어지도록 예외가 serialize될 때 발생합니다.

(다음에서 상속됨 Exception)

명시적 인터페이스 구현

ISerializable.GetObjectData(SerializationInfo, StreamingContext)

지정된 SmtpFailedRecipientsExceptionSerializationInfo 인스턴스에서 StreamingContext 클래스의 새 인스턴스를 초기화합니다.

적용 대상