Read an HTML/Text file and Send it as a HTML Formated Email in WPF/C# -


i have wpf application sends out html-formatted email when button clicked. entire email message in html-format , work.

however, wondering if there way read html file , send out rather writing whole message in code behind...keeping html formatting in-tact.

i tried this:

string messagetosend = file.readalltext("path txt/html file"); 

but sent out email has text (no styling, no html...just plain text found in file).

then thought, may have convert everything:

string messagetosend = convert.tostring(file.readalltext("path txt/html file")); 

but same thing before.

is there way achieve this? or have stick having

string messagetosend = @"<html> ... lots of html stuff ... </html>"; 

for every button sends email?

for notice: contents of .txt , .html file attempted read tested using same contents of above string (which, again, works expected), , without double quotes (example: width=""100"" , width="100")

try adding encoding file read:

string messagetosend = file.readalltext("path txt/html file", encoding.utf8); 

try reading file containing < , compare string "<". repeat special characters until find mismatch. find character number this:

(int)messagetosend[0] // < should 60 (3c in utf-8) 

find out offending characters are, , may able help. if read file, not see problem.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -