G
Guest
I am using stringbuilder to create a html email message that is basically a
two column table with the field name in one column, and the field value in
another, and about 30 rows. I don't get any errors when the code runs, but
there seems to be always one field that has the wrong background color, or
has a "!" in the text of the e-mail message. On the e-mail message, when I
click "View Source", I see that at the end of many rows, there is a "!"
character at the end. So, instead of bgcolor="#b0e0e6", I see bgcolor="#b!
and then you have go down one line and all the way to the left (in view
source), to see the rest of the characters; 0e0e6". The location of this
error is different in other e-mails and depends on how many fields I put in
the particular e-mail. If I create a really short e-mail, then I don't have
this problem. Has anyone encountered this? Any help would be appreciated.
Here is the example code;
Dim strMessage As New StringBuilder
strMessage.Append("<html>")
strMessage.Append("<body>")
strMessage.Append("<table width=""100%"" border=""1"" align=""center""
cellpadding=""2"" cellspacing=""1"">")
strMessage.Append("<tr>")
strMessage.Append("<td width=""40%""
bgcolor=""#b0e0e6""><strong><fontcolor=""#000099"" size=""2"">")
strMessage.Append("Project Number")
strMessage.Append("</strong></td>")
strMessage.Append("<td width=""60%""
bgcolor=""#b0e0e6""><strong><fontcolor=""#000099"" size=""2"">")
strMessage.Append(strProjnum)
strMessage.Append("</strong></td>")
strMessage.Append("</tr>")
strMessage.Append("<tr>")
strMessage.Append("<td width=""40%""
bgcolor=""#b0e0e6""><strong><fontcolor=""#000099"" size=""3"">")
strMessage.Append("Request Number")
strMessage.Append("</font></strong></td>")
strMessage.Append("<td width=""60%""
bgcolor=""#b0e0e6""><strong><fontcolor=""#000099"" size=""4"">")
strMessage.Append(strRequestnum)
strMessage.Append("</font></strong></td>")
strMessage.Append("</tr>")
strMessage.Append("</table>")
strMessage.Append("</body>")
strMessage.Append("</html>")
Dim newMail As New MailMessage
newMail.From = "(e-mail address removed)"
newMail.To ="(e-mail address removed)"
newMail.Subject = "Hardware Request Confirmation - New"
newMail.Body = strMessage.ToString
newMail.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = "mailserver.jcpenney.com"
SmtpMail.Send(newMail)
two column table with the field name in one column, and the field value in
another, and about 30 rows. I don't get any errors when the code runs, but
there seems to be always one field that has the wrong background color, or
has a "!" in the text of the e-mail message. On the e-mail message, when I
click "View Source", I see that at the end of many rows, there is a "!"
character at the end. So, instead of bgcolor="#b0e0e6", I see bgcolor="#b!
and then you have go down one line and all the way to the left (in view
source), to see the rest of the characters; 0e0e6". The location of this
error is different in other e-mails and depends on how many fields I put in
the particular e-mail. If I create a really short e-mail, then I don't have
this problem. Has anyone encountered this? Any help would be appreciated.
Here is the example code;
Dim strMessage As New StringBuilder
strMessage.Append("<html>")
strMessage.Append("<body>")
strMessage.Append("<table width=""100%"" border=""1"" align=""center""
cellpadding=""2"" cellspacing=""1"">")
strMessage.Append("<tr>")
strMessage.Append("<td width=""40%""
bgcolor=""#b0e0e6""><strong><fontcolor=""#000099"" size=""2"">")
strMessage.Append("Project Number")
strMessage.Append("</strong></td>")
strMessage.Append("<td width=""60%""
bgcolor=""#b0e0e6""><strong><fontcolor=""#000099"" size=""2"">")
strMessage.Append(strProjnum)
strMessage.Append("</strong></td>")
strMessage.Append("</tr>")
strMessage.Append("<tr>")
strMessage.Append("<td width=""40%""
bgcolor=""#b0e0e6""><strong><fontcolor=""#000099"" size=""3"">")
strMessage.Append("Request Number")
strMessage.Append("</font></strong></td>")
strMessage.Append("<td width=""60%""
bgcolor=""#b0e0e6""><strong><fontcolor=""#000099"" size=""4"">")
strMessage.Append(strRequestnum)
strMessage.Append("</font></strong></td>")
strMessage.Append("</tr>")
strMessage.Append("</table>")
strMessage.Append("</body>")
strMessage.Append("</html>")
Dim newMail As New MailMessage
newMail.From = "(e-mail address removed)"
newMail.To ="(e-mail address removed)"
newMail.Subject = "Hardware Request Confirmation - New"
newMail.Body = strMessage.ToString
newMail.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = "mailserver.jcpenney.com"
SmtpMail.Send(newMail)