Including name with eMail Adddress when using MailMessage Class

  • Thread starter Thread starter CarlInAl
  • Start date Start date
C

CarlInAl

Rather than setting the MailMessage.To and MailMessage.From properties
with something like "(e-mail address removed)" I would like to include
the name along with the email address.

Is something like this possible to set the To property to send and
email to John Doe?

MailMessage eMail = new MailMessage();
eMail.To =@''John Doe[[email protected]";

Big thanks for any help on this.
 
Try

eMail.To = "John Doe <[email protected]>";

That's how you'd usually set the to property in an email header.
Please note that I have not tried this out with .NET :)

/Brian
 
Back
Top