Ver Mensaje Individual
  #10 (permalink)  
Antiguo 14/05/2004, 11:14
Avatar de lucxx
lucxx
 
Fecha de Ingreso: noviembre-2003
Ubicación: Madrid
Mensajes: 321
Antigüedad: 21 años, 3 meses
Puntos: 0
Lo mejoramos un poco, y tomamos en cuenta el caso de que no haya noticias:

mensaje = "<table> <tr>"

if dr.Read() then

mensaje &= "<td>" & dr("TITULAR") & "</td></tr>"
mensaje &= "<td>" & dr("NOTICIA") & "</td></tr>"

do while dr.read()
mensaje &= "<td>" & dr("TITULAR") & "</td></tr>"
mensaje &= "<td>" & dr("NOTICIA") & "</td></tr>"
loop

else

hayNoticias = false
mensaje &= "</tr>"

end if


mensaje &= "</table>"

if hayNoticias then

Dim _mm As New System.Web.Mail.MailMessage
Do While dr.Read
_mm.To = CStr(dr("Email"))
_mm.From = "[email protected]"
_mm.Subject = "Algun título"
_mm.BodyFormat = Mail.MailFormat.Html 'opcional
_mm.Body = "Mensaje"
System.Web.Mail.SmtpMail.SmtpServer = "tu_smtp"
Try
System.Web.Mail.SmtpMail.Send(_mm)
Catch ex As Exception
End Try
Loop

end if


Salu2