Groups | Blog | Home
all groups > asp.net datagrid control > october 2007 >

asp.net datagrid control : sending an html email doesnt convert to html.



mcarol44
10/24/2007 11:03:00 AM
I'm trying to send an html email generated from text but when my email comes
through I can see all of the html tags. The email is not being converted to
html but coming through as plain text. Here is the text I'm trying to send
with the code that sends it

email that should go out as html
<html>
<head>
<title>Your Order the store Online</title>
</head>
<body>
Dear customer,<br /><br />
Thank you for your order at the store Online. Your order number is
<b>##OrderNumber##</b><br /><br />
Below you find a list of the products you have ordered. The goods will
ship as
soon as we receive your payment.<br /><br />
##ShoppingCart##
<br /><br />
Thanks<br /><br />
The store Team
</body>
</html>

Here is the code that sends that email out.

Public Shared Sub SendConfirmationMessage( _
ByVal theShoppingCart As ShoppingCart, ByVal orderId As Integer, _
ByVal emailAddress As String)

Try
Dim myGridView As GridView = CreateGridView()
myGridView.DataSource = theShoppingCart.Items
myGridView.DataBind()

If myGridView.Rows.Count > 0 Then
myGridView.FooterRow.Cells(0).Text = "Totals:"
myGridView.FooterRow.Cells(3).Text = _
String.Format("{0:c}", theShoppingCart.Total)

Dim theSubject As String = "Your order at Carefree Jewelry"
Dim theMessage As String = My.Computer.FileSystem.ReadAllText _
(AppConfiguration.ConfirmationMessageLocation)

Dim mySmtpClient As New System.Net.Mail.SmtpClient
theMessage = theMessage.Replace("##ShoppingCart##", _
GetHtmlFromControl(myGridView))
theMessage = theMessage.Replace("##OrderNumber##", orderId.ToString())
mySmtpClient.Send("info@mydomain.com", emailAddress, theSubject,
theMessage)
End If
Catch ex As Exception
End Try
End Sub




mcarol44
10/25/2007 2:27:00 PM

--
Thanks,
Matt


[quoted text, click to view]
AddThis Social Bookmark Button