SmtpFrom Property
Gets or sets EmailAddress object specifying the message sender.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.2.0 build 630 for .NET 4.5
public EmailAddress From { get; set; }

Property Value

Type: EmailAddress
The EmailAddress object representing From: field of the message.
This property is equivalent to From property of Message object.
Setting the message sender using different methods.
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.SmtpMail;
using MailBee.Mime;

// The actual code (put it into a method of your class)

Smtp mailer = new Smtp();

// Method 1: Setting Display Name and E-mail separately.
mailer.From.DisplayName = "John Doe, Sales Manager";
mailer.From.Email = "";

// Method 2: Setting From field as string.
mailer.From.AsString = "\"John Doe, Sales Manager\" <>";

// Method 3: Setting From field as EmailAddress.
mailer.From = new EmailAddress("John Doe, Sales Manager", "");

// Method 4: Setting From field using Headers collection.
mailer.Message.Headers["From"] = "\"John Doe, Sales Manager\" <>";
See Also