MailAddress.Address 속성

정의

이 인스턴스를 만들 때 지정된 전자 메일 주소를 가져옵니다.

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

속성 값

전자 메일 주소를 포함하는 A String 입니다.

예제

다음 코드 예제에서는 전자 메일 메시지 받는 사람에 대 한 주소를 표시 합니다.

public static void CreateCopyMessage(string server)
{
    MailAddress from = new MailAddress("ben@contoso.com", "Ben Miller");
    MailAddress to = new MailAddress("jane@contoso.com", "Jane Clayton");
    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("Notification_List@contoso.com");
    message.CC.Add(copy);
    SmtpClient client = new SmtpClient(server);
    // Include credentials if the server requires them.
    client.Credentials = CredentialCache.DefaultNetworkCredentials;
    Console.WriteLine("Sending an email message to {0} by using the SMTP host {1}.",
         to.Address, client.Host);

    try
    {
        client.Send(message);
    }
    catch (Exception ex)
    {
        Console.WriteLine("Exception caught in CreateCopyMessage(): {0}",
            ex.ToString());
    }
}

설명

이 속성에서 반환된 값에는 정보가 포함되지 DisplayName 않습니다.

적용 대상