Question

MailMessage setting the Senders Name

Is it possible to set the sender name on a MailMessage object? I tried setting it from MailAddress, but the DisplayName property seems to be read only.

I tried "My Name " as the sender and don't seem to work either.

 45  55091  45
1 Jan 1970

Solution

 122
MailMessage mail = new MailMessage();
mail.From = new MailAddress("nerfDeathKnights@mycompany.com", "Bob Jones" );
2010-02-09

Solution

 22

You do not need to use the MailAddress class.

You can let the runtime parse your string.

var message = new MailMessage(
    "My Name my@name.com", 
    "Recipient One recipient@one.com,Recipient Two recipient@two.com",
    "Subject",
    "Body");
2011-05-25