Hi Guys,

Currently i have a c# function that generates an email after the user has updated certain information in an asp.net webpage. i am using stringbuilder type and i hardcode everything in a strbody to be later print out.

The only problem is sometimes the email might get a strange one ! character coming up that messes up the email format.

Below are some of the stuff that i've used. And the hardcoded html i used.

Code:
strBody.Append("<table class='MsoNormalTable' style='BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; WIDTH: 525pt; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse' cellSpacing='0' borderColorDark='#ffffff' cellPadding='0' width='700' borderColorLight='#ffffff' border='1'>");

if(type == "PE")
						{
							string strDEL = dr["DEL"].ToString();
							string strDE = dr["DE"].ToString();
							string strF = dr["F"].ToString();
							string strP = dr["P"].ToString();
						
							if(printHeader)
							{
								strBody.Append("<td><p class='MsoNormal'><font face='Tahoma' color='white' size='2'>PEN</font></p></td>");
								strBody.Append("<td><p class='MsoNormal'><font face='Tahoma' color='white' size='2'>PN</font></p></td>");
								strBody.Append("<td><p class='MsoNormal'><font face='Tahoma' color='white' size='2'>D</font></p></td>");
								strBody.Append("<td><p class='MsoNormal'><font face='Tahoma' color='white' size='2'>P</font></p></td>");
								strBody.Append("<td><p class='MsoNormal'><font face='Tahoma' color='white' size='2'>Fa</font></p></td></tr>");

								printHeader = false;
							}
							
							if(evenRow)
							{
								strBody.Append("<tr style='BORDER-RIGHT: white 1pt inset; PADDING-RIGHT: 2.25pt; BORDER-TOP: medium none; PADDING-LEFT: 2.25pt; BACKGROUND: #f2f2f2; PADDING-BOTTOM: 2.25pt; BORDER-LEFT: white 1pt inset; WIDTH: 22.5pt; PADDING-TOP: 2.25pt; BORDER-BOTTOM: white 1pt inset' vAlign='top' bgColor='#f2f2f2' width='30'>");	
								evenRow = false;
							}
							else
							{
								strBody.Append("<tr style='BORDER-RIGHT: white 1pt inset; PADDING-RIGHT: 2.25pt; BORDER-TOP: medium none; PADDING-LEFT: 2.25pt; BACKGROUND: #e9e9e9; PADDING-BOTTOM: 2.25pt; BORDER-LEFT: white 1pt inset; WIDTH: 22.5pt; PADDING-TOP: 2.25pt; BORDER-BOTTOM: white 1pt inset' vAlign='top' bgColor='#e9e9e9' width='30'>");	

newMsg.Body = msgBody;

SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["SMTPServer"];
SmtpMail.Send(newMsg);
Any idea how to stop or prevent this?