1

I have an email template in a file called template.html, how can i use it as mail body in asp.net?

tone
  • 1,535
  • 3
  • 15
  • 20
  • possible duplicate of [Can I set up HTML/Email Templates with ASP.NET?](http://stackoverflow.com/questions/620265/can-i-set-up-html-email-templates-with-asp-net) – BrunoLM Oct 11 '10 at 20:38

2 Answers2

3

There's a sample here with code.

Or you could use the MailDefinition class.

David
  • 72,686
  • 18
  • 132
  • 173
3

You can use this:

File.ReadAllText("template.html")

//This is to read template.html then you can pass this through
//formatemail() function if you have or
//message.body = File.ReadAllText("template.html");
Darkzaelus
  • 2,059
  • 1
  • 15
  • 31
XUB Inc.
  • 31
  • 1