MailAddress.User 속성

정의

이 인스턴스를 만들 때 지정된 주소에서 사용자 정보를 가져옵니다.

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

속성 값

의 사용자 이름 부분을 String포함하는 A Address 입니다.

예제

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

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"사용자는 .입니다 "tsmith".

적용 대상