Hello all,
I'm building a string using stringbuilder and sending the results in an email. If I view the stringbuilder in debug mode it looks just fine. Here is how it looks in debug mode (ie ?sb.tostring):
"ORDER DETAILS
Fragrance: Chocolate Mocha Delight | Quantity: 1 | Price: $10.00 | Total:$11.50
Fragrance: Decadent Strawberry Shortcake | Quantity: 1 | Price: $10.00 | Total:$11.50
Fragrance: Pecan Pie | Quantity: 1 | Price: $10.00 | Total:$11.50
Order Total: $33.00
"
This is the correct way. It should look like this in my email
However when I recieve the email, it looks like the stringbuilder.appendline did not happen. It looks like this in my email:
ORDER DETAILS Fragrance: Chocolate Mocha Delight | Quantity: 1 | Price: $10.00 | Total:$11.50 Fragrance: Decadent Strawberry Shortcake | Quantity: 1 | Price: $10.00 | Total:$11.50 Fragrance: Pecan Pie | Quantity: 1 | Price: $10.00 | Total:$11.50 Order Total: $33.00
Here is my code:
I also tried using the ascii carriage return (ie chr(13)) and I still get the same result. I also have the isbodyhtml property set to true in my email class. I'm using ASP.NET 2.0 and VB2005.Code:Dim Dollars As Double = 0 Dim EmailMessage As Email = New Email EmailMessage.AddRecipient("[email protected]") EmailMessage.subject = "New order from " & txtLastName.Text & ", " & txtFirstName.Text Dim sb As StringBuilder = New StringBuilder sb.Appendline("ORDER DETAILS") For Each dr As datarow In Cart.dtShoppingCart.Rows sb.Append("Fragrance: ") sb.Append(dr.Item("ProductName")) sb.Append(" | ") sb.Append("Quantity: ") sb.Append(dr.Item("Quantity")) sb.Append(" | ") sb.Append("Price: ") Dollars = dr.Item("ListPrice") sb.Append(Dollars.ToString("c")) sb.Append(" | ") If Cart.dtShoppingCart.Rows(0)("WickInd") = True Then sb.Append("Wick included | ") sb.Append("Total:") Dollars = (dr.Item("ListPrice") + dr.Item("WickPrice")) * dr.Item("Quantity") sb.Appendline(Dollars.ToString("c")) Else sb.Append("Total:") Dollars = (dr.Item("ListPrice") + dr.Item("WickPrice")) * dr.Item("Quantity") sb.Appendline(Dollars.ToString("c")) End If Next dr Dollars = Cart.ShoppingCartTotal sb.Appendline("Order Total: " & Dollars.ToString("c")) EmailMessage.body = sb.ToString EmailMessage.Send()
Anyone know the correct syntax?
Thanks,
Strick




Reply With Quote