emblewembl
Programmer
I'm building an html table to send as an html email but some of the string seems to change slightly when it comes through (I'm viewing the email in hotmail).
Here's how I'm buiding the string which gets passed to the email function:
My email function is like this:
It works fine, the email arrives and the html has almost worked but the table has some strangely formatted cells. It seems strange as the string is built in a loop so I don't understand how some rows are fine, some aren't. I've looked at the source of the email and it looks as though some of the'<' for instance in <td> are getting changed to < or >.
How can I stop this happening?
i love chocolate
Here's how I'm buiding the string which gets passed to the email function:
Code:
StringBuilder emailMessage = new StringBuilder();
//emailMessage.Append("An order has been placed as follows:<br />");
//job ref, date and customer address
foreach (ImageObject io in arrImages)
{
emailMessage.Append("<tr>");
emailMessage.Append("<td style='font-family:Arial; font-size:10px; color: #666666; font-weight:bold; background-color:#ffffff;'>" + io.quantity + "</td>");
emailMessage.Append("<td style='font-family:Arial; font-size:10px; color: #666666; font-weight:bold; background-color:#ffffff;'>" + io.imgId + "</td>");
emailMessage.Append("<td style='font-family:Arial; font-size:10px; color: #666666; font-weight:bold; background-color:#ffffff;'>" + io.size + "</td>");
emailMessage.Append("<td style='font-family:Arial; font-size:10px; color: #666666; font-weight:bold; background-color:#ffffff;'>" + io.unitPrice + "</td>");
emailMessage.Append("<td style='font-family:Arial; font-size:10px; color: #666666; font-weight:bold; background-color:#ffffff;'>" + io.imgPrice + "</td>");
emailMessage.Append("</tr>");
decimal sPrice = decimal.Round(io.imgPrice,2);
subTotal += sPrice;
}
My email function is like this:
Code:
MailMessage msg = new MailMessage();
msg.To = sendto;
msg.From = sendFrom;
msg.BodyFormat = MailFormat.Html;
etc.....
It works fine, the email arrives and the html has almost worked but the table has some strangely formatted cells. It seems strange as the string is built in a loop so I don't understand how some rows are fine, some aren't. I've looked at the source of the email and it looks as though some of the'<' for instance in <td> are getting changed to < or >.
How can I stop this happening?
i love chocolate