Monday, March 2, 2009

Sending Email from HTML

I decide to use File rather then web request coz some server are restricted to loopback.

///
/// Get Email Body from file
///

///
public static string GetEmailBodyFromFile(string filePath)
{
string emailMasterBody = "";

Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
using (System.IO.StreamReader objReader = new StreamReader(filePath, encode))
{
emailMasterBody = objReader.ReadToEnd();
}

return emailMasterBody;
}

No comments: