tags:

views:

80

answers:

2

I need to send a email from application with text in the from field. I have the from email address, but how do I mask the email address so the from message renders the text not the email address?

+1  A: 

MailAddress (that you will use for 'To' and 'From' properties) can take a display name along with the address in its constructor. You need to verify how different mail clients use the value to display (most use a combination of both).

Mohit Chakraborty
+1  A: 

You can add a name to the sender this way, using the MailAddress object:

MailMessage message = new MailMessage();
message.From = new MailAddress("[email protected]", "John Doe");
splattne
MailMessage message = new MailMessage();message.From = new MailAddress("John Doe", "[email protected]");
Dedrick
According to http://msdn.microsoft.com/en-us/library/1s17zfkf.aspx it's address first, then name
splattne