MailAddress.User Egenskap
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Hämtar användarinformationen från den adress som angavs när den här instansen skapades.
public:
property System::String ^ User { System::String ^ get(); };
public string User { get; }
member this.User : string
Public ReadOnly Property User As String
Egenskapsvärde
En String som innehåller användarnamnsdelen av Address.
Exempel
I följande kodexempel visas målet för ett e-postmeddelande.
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);
}
Kommentarer
I en typisk e-postadress innehåller användarsträngen all information som föregår "@"-tecknet. I "tsmith@contoso.com"är "tsmith"till exempel användaren .