This documentation is archived and is not being maintained.

MailMessage.From Property

Gets or sets the e-mail address of the sender.

[Visual Basic]
Public Property From As String
[C#]
public string From {get; set;}
[C++]
public: __property String* get_From();
public: __property void set_From(String*);
[JScript]
public function get From() : String;
public function set From(String);

Property Value

The sender's e-mail address.

Example

[Visual Basic] 
Dim  MyMessage As MailMessage = New MailMessage()
MyMessage.From = "john@contoso.com"

[C#] 
MailMessage MyMessage = new MailMessage();
MyMessage.From = "john@contoso.com";

[C++] 
MailMessage* MyMessage = new MailMessage();
MyMessage->From = S"john@contoso.com";

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

MailMessage Class | MailMessage Members | System.Web.Mail Namespace

Show: