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?
From stackoverflow
-
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).
-
You can add a name to the sender this way, using the MailAddress object:
MailMessage message = new MailMessage(); message.From = new MailAddress("john.doe@foo.bar.com", "John Doe");
Dedrick : MailMessage message = new MailMessage(); message.From = new MailAddress("John Doe", "john.doe@foo.bar.com");splattne : According to http://msdn.microsoft.com/en-us/library/1s17zfkf.aspx it's address first, then name
0 comments:
Post a Comment