MailAddress.Host 속성

정의

이 인스턴스를 만들 때 지정된 주소의 호스트 부분을 가져옵니다.

public:
 property System::String ^ Host { System::String ^ get(); };
public string Host { get; }
member this.Host : string
Public ReadOnly Property Host As String

속성 값

String 속성에 대한 전자 메일을 수락하는 호스트 컴퓨터의 이름이 들어 있는 A User 입니다.

예제

다음 코드 예제에서는 전자 메일 메시지의 대상을 표시합니다.

public static void CreateTestMessage3()
{
    MailAddress to = new MailAddress("jane@contoso.com");
    MailAddress from = new MailAddress("ben@contoso.com");
    MailMessage message = new MailMessage(from, to);
    message.Subject = "Using the new SMTP client.";
    message.Body = @"Using this new feature, you can send an email message from an application very easily.";
    // Use the application or machine configuration to get the
    // host, port, and credentials.
    SmtpClient client = new SmtpClient();
    Console.WriteLine("Sending an email message to {0} at {1} by using the SMTP host={2}.",
        to.User, to.Host, client.Host);
    client.Send(message);
}

설명

일반적인 전자 메일 주소에서 호스트 문자열에는 "@" 기호 다음의 모든 정보가 포함됩니다. 예를 들어 호스트는 "tsmith@contoso.com".입니다 "contoso.com".

적용 대상