MailAddress.Host Özellik

Tanım

Bu örnek oluşturulduğunda belirtilen adresin ana bilgisayar bölümünü alır.

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

Özellik Değeri

String Özelliği için User e-posta kabul eden ana bilgisayarın adını içeren.

Örnekler

Aşağıdaki kod örneği bir e-posta iletisinin hedefini görüntüler.

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);
}

Açıklamalar

Tipik bir e-posta adresinde, konak dizesi "@" işaretini izleyen tüm bilgileri içerir. Örneğin, içinde "tsmith@contoso.com"konak şeklindedir "contoso.com".

Şunlara uygulanır