Can I set the email body to the contents of an HTML file using ASP.NET?
I'm sure you can do it using ASP and CDOSYS, but I can't find a property in MailMessage class in .NET.
Any ideas?
Can I set the email body to the contents of an HTML file using ASP.NET?
I'm sure you can do it using ASP and CDOSYS, but I can't find a property in MailMessage class in .NET.
Any ideas?
Don't think so. What I've done in cases just like this is to read the mail body from a file -- In my case using an XmlReader since I do some additional processing on the file. If you want to just send a static file, a StreamReader should do.
Wolffy
.-- ----- ..-. ..-. -.--
Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Void where prohibited by law. Not valid in California. Your mileage may vary.
You can accomplish this by using the System.IO namespace:
Then, simply set the Body property to strBodyHTML.Code:string strbodyHTML = File.ReadAllText(txtFileFullPath);
jmurrayhead
If you agree, give me rep.
If you like it here...throw us a few bones to help support us.
Cool. I had forgotten about that method.
Wolffy
.-- ----- ..-. ..-. -.--
Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Void where prohibited by law. Not valid in California. Your mileage may vary.
jmurrayhead
If you agree, give me rep.
If you like it here...throw us a few bones to help support us.
Bookmarks