MailAddress.User Eigenschap

Definitie

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

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

Waarde van eigenschap

Een String met het gebruikersnaamgedeelte van de Address.

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 gebruikerstekenreeks alle informatie die voorafgaat aan het@ ''-teken. Bijvoorbeeld: in "tsmith@contoso.com", de gebruiker is "tsmith".

Van toepassing op