Storing Smtp from a mobile phone name in Web.Config

I store my email settings in a web configuration, for example ...

<mailSettings> <smtp from="splidge@findremovalcompanies.com"> <network host="smtp.findremovalcompanies.com" userName="splidge@findremovalcompanies.com" password="password" /> </smtp> </mailSettings> 

Now when i create a new

 var smtp = new SmtpClient(); 

smpt has my credentials and will be by default from the address to splidge@findremovalcompanies.com, which will save me from having to do this every time.

 MailAddress("splidge@findremovalcompanies.com", "Splidge Master") 

But I can't figure out how to specify the friendly display name "Splidge Master" in the web.config file. No settings for it?

+64
web-config smtp
08 Sep '09 at 14:31
source share
3 answers

You can use html encoded <and> (& lt; and>) to deliver the display name in the from attribute.

<smtp deliveryMethod="Network" from="Mail Displayname &lt;mail@raccoom.net&gt;">

+128
Sep 08 '09 at 14:36
source share

From memory, the from= from="Display Name &lt;me@example.com&gt;" attribute should be changed from="Display Name &lt;me@example.com&gt;" .

+11
Sep 08 '09 at 14:38
source share

If you need the exact equivalent, encode double quotes ( &quot; ) too:

 <smtp from="&quot;Splidge Master&quot; &lt;splidge@findremovalcompanies.com&gt;"> 
0
Dec 06 '17 at 8:30
source share



All Articles