Edit

Share via


MailDefinition.From Property

Definition

Gets or sets the email address of the message sender.

public:
 property System::String ^ From { System::String ^ get(); void set(System::String ^ value); };
public string From { get; set; }
member this.From : string with get, set
Public Property From As String

Property Value

The email address of the message sender. The default is Empty.

Examples

The following code example sets the From property to the text entered in a TextBox control on a Web Forms page.

This code example is part of a larger example provided for the MailDefinition class.

md.From = sourceFrom.Text;
md.From = sourceFrom.Text

Remarks

The From property contains the email address of the sender of the email message. If the From property is left blank, or contains an improperly formed email address, the SmtpClient.Send method throws an HttpException exception and the email message is not sent.

Applies to

See also