MailAddress.Host Eigenschap

Definitie

Hiermee haalt u het hostgedeelte van het adres op dat is opgegeven toen dit exemplaar werd gemaakt.

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

Waarde van eigenschap

Een String met de naam van de hostcomputer die e-mail voor de User eigenschap accepteert.

Voorbeelden

In het volgende codevoorbeeld wordt het doel van een e-mailbericht weergegeven.

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

Opmerkingen

In een typisch e-mailadres bevat de hosttekenreeks alle informatie na het '@'-teken. De host is "contoso.com"bijvoorbeeld "tsmith@contoso.com"in .

Van toepassing op