RE: sending HTML email

From: Bill Borg (BillBorg_at_discussions.microsoft.com)
Date: 11/09/04


Date: Tue, 9 Nov 2004 12:53:01 -0800

Justin, it depends more on how you want to maintain the text (e.g. from a
text file, in the db, in a web control, etc.). All of these are doable. In a
text file, I'd go (vb):

  public function GetMyText as string
        Dim fi As New System.IO.FileInfo(Server.MapPath("~\myText.txt"))
        Dim sr As System.IO.StreamReader = fi.OpenText()
        return sr.ReadToEnd
  end function

then... mailmessage.body = GetMyText()

If it's mostly static and you send a lot of them, you should also consider
caching the text at the app level.

hth,
Bill

"Justin" wrote:

> I have a fairly large piece of html, about 50 lines that I would like to send
> via an ASP.NET page I was wondering what would be the best and cleanest way
> to do this? Is there a way I can put the code in a WebControl or text file
> and pass that to Mailmessage.Body?
>
> Any suggestions would be great.
>
> Thanks, Justin.