MailDefinition.From Свойство
Определение
Получает или задает адрес электронной почты отправителя сообщения.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
Значение свойства
Адрес электронной почты отправителя сообщения.The email address of the message sender. Значение по умолчанию — Empty.The default is Empty.
Примеры
В следующем примере кода для From свойства задается текст, указанный TextBox в элементе управления на странице веб-форм.The following code example sets the From property to the text entered in a TextBox control on a Web Forms page.
Этот пример кода является частью большого примера, MailDefinition приведенного для класса.This code example is part of a larger example provided for the MailDefinition class.
md.From = sourceFrom.Text;
md.From = sourceFrom.Text
Комментарии
From Свойство содержит адрес электронной почты отправителя сообщения электронной почты.The From property contains the email address of the sender of the email message. Если свойство оставлено пустым или содержит неправильно сформированный адрес электронной почты SmtpClient.Send , метод выдает HttpException исключение, и сообщение электронной почты не отправляется. FromIf 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.