Html tags not formating inside c# string.format -


i trying send email formatted html inside string , argument.
code this:

string title = "big"; string text = "<p>email stuff <b>important</b> {0} stuff</p>"; string.format(text, title);   mailmessage msz = new mailmessage(); var studentemail = "someplace@somewhere.net";   msz.to.add(new mailaddress(studentemail, "someone"));  msz.from = new mailaddress(from);                                      msz.subject = "subject"; msz.body = bodytext; smtpclient smtp = new smtpclient(); smtp.enablessl = true;  smtp.send(msz); 

i want in email "email stuff important big stuff", getting in email: <p>email stuff <b>important</b> {0} stuff</p>

actually depend on how did send email.

you should store text body part of mailmessage

string title = "big"; string text = "<p>email stuff <b>important</b> {0} stuff</p>"; string.format(text, title);   mailmessage message = new mailmessage(); message.from = "sender@abc.com"); message.to.add("dummy@abc.com"); message.subject = title; message.isbodyhtml = true; message.body = text; 

with isbodyhtml = true, format html tag.

for sending:

smtpclient smtpclient = new smtpclient() ... smtpclient.send(message); 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -