Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/06/2012, 10:54
mrprogman
 
Fecha de Ingreso: junio-2011
Mensajes: 329
Antigüedad: 12 años, 9 meses
Puntos: 2
Formato Correo asp.net

Mando un correo por asp.net desde una aplicacion web en y a la hora de abrirlo en el navegador o en el outlook, me muestra el codigo html.. no me lo interpreta en la tabla...me lo muestra de la siguiente manera o sea manda el codigo html

<div>
<table cellspacing="0" rules="all" border="1" id="GridView1" style="border-collapse:collapse;">
<tr>
<th scope="col"> </th><th scope="col">id</th><th scope="col">Linea</th><th scope="col">Descripcion</th><th scope="col">Valor</th>
</tr><tr>
<td><a href="javascript:__doPostBack('GridView1','Select$ 0')">Select</a></td><td>1</td><td>Pirelli</td><td>Auto & Camioneta PR</td><td> </td>
</tr><tr>
<td><a href="javascript:__doPostBack('GridView1','Select$ 1')">Select</a></td><td>2</td><td>Pirelli</td><td>Camion PR</td><td> </td>
</tr><tr>
<td><a href="javascript:__doPostBack('GridView1','Select$ 2')">Select</a></td><td>3</td><td>Hankook</td><td>Auto y Camioneta HK</td><td> </td>
</tr><tr>
<td><a href="javascript:__doPostBack('GridView1','Select$ 3')">Select</a></td><td>4</td><td>Hankook</td><td>Camion HK</td><td> </td>
</tr><tr>
<td><a href="javascript:__doPostBack('GridView1','Select$ 4')">Select</a></td><td>5</td><td>Goodyear</td><td>Auto y Camioneta GYR</td><td> </td>
</tr><tr>
<td><a href="javascript:__doPostBack('GridView1','Select$ 5')">Select</a></td><td>6</td><td>Goodyear</td><td>Camion GYR</td><td> </td>
</tr>
</table>
</div>


anexo el codigo con el que mando el correo:

Private Function GridViewToHtml(ByVal gv As GridView) As String
Dim sb As New StringBuilder()
Dim sw As New StringWriter(sb)
Dim hw As New HtmlTextWriter(sw)
GridView1.RenderControl(hw)
Return sb.ToString()
End Function

Protected Sub SendMailButton_Click(ByVal sender As Object, ByVal e As EventArgs)

End Sub
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)

End Sub




Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SendMailButton.Click
Dim mail As New MailMessage()
mail.Body = GridViewToHtml(GridView1)
mail.IsBodyHtml = True
' The same logic as you use for sending mail

Dim correo As New System.Net.Mail.MailMessage
correo.From = New System.Net.Mail.MailAddress(TextBox1.Text)
correo.To.Add(TextBox2.Text)
correo.Subject = TextBox3.Text
correo.Body = GridViewToHtml(GridView1)
correo.IsBodyHtml = False
correo.Priority = System.Net.Mail.MailPriority.Normal

Dim smtp As New System.Net.Mail.SmtpClient
smtp.Host = "192.168.10.80"
smtp.Port = "25"
'smtp.EnableSsl = True
smtp.Credentials = New System.Net.NetworkCredential("[email protected]", "correo")
Try
smtp.Send(correo)
Label3.Text = "Mensaje enviado satisfactoriamente"
Catch ex As Exception
Label3.Text = "ERROR: " & ex.Message
End Try

alguien me puede ayudar por favor..?..saludos y gracias por sus respuestas

End Sub