Hi Susan,
I run my email body through a formatter, e.g., string myEmailBody = Formatter.FormattedContent(e.BodyText);
The code for it follows; you'll see that I added some additional formatting commands.
/// <summary>
/// Summary description for Formatter
/// </summary>
public class Formatter{
public static string FormattedContent(string textToFormat, bool isWordWrap) {
return FormattedContent(textToFormat);
}
public static string FormattedContent(string textToFormat) {
string comment = textToFormat;
comment = HttpContext.Current.Server.HtmlEncode(comment);
comment = comment.Replace(" ", " ");
comment = comment.Replace("\t", " ");
comment = comment.Replace("----", "<HR>");
comment = comment.Replace("\r", "<BR>");
comment = comment.Replace(">>", ">");
comment = comment.Replace("<<", "<");
comment = comment.Replace("[!", "<font color=red><b>");
comment = comment.Replace("[[", "<font color=blue><b>");
comment = comment.Replace("]]", "</font></b>");
return comment;
}
public static string CommandLegend() {
string retVal =
"Formatting commands follow:<br />" +
"<table border=1>" +
" <tr><td bgcolor=Gainsboro><b>Syntax</b></td>" +
" <td bgcolor=Gainsboro><b>Would appear as</b></td></tr>" +
" <tr>" +
" <td>" +
" [!This is a test]]" +
" </td>" +
" <td>" +
" <strong><span style=\"color: red\">This is a test</span></strong></td>" +
" </tr>" +
" <tr>" +
" <td>" +
" [[This is a test]]" +
" </td>" +
" <td>" +
" <strong><span style=\"color: #3300ff\">This is a test</span></strong></td>" +
" </tr>" +
" <tr>" +
" <td>" +
" ----;</td>" +
" <td>" +
" Horizontal line</td>" +
" </tr>" +
" <tr>" +
" <td>" +
" <<font color=red>>Hi!<</font>></td>" +
" <td>" +
" <span style=\"color: red\">Hi!</span></td>" +
" </tr>" +
"</table>" ;
return retVal;
}
public Formatter()
{
}
}