|
|
|
E-mail content of a webpage as html-mail
1
Simple code to get the html of a webpage and send is as a html email msg.
Imports system
Imports System.web.mail
<script language="VB" runat="server">
Sub sendmail()
Dim mail As New MailMessage()
Dim url As String = "http://www.some-url.com"
mail.From = "your adres"
mail.Subject = "Subject of the mail"
mail.BodyFormat = MailFormat.Html
mail.Body = HttpContent(url)
SmtpMail.SmtpServer = "your smtp server adres"
mail.To = "destination email adres"
SmtpMail.Send(mail)
End Sub
Private Function HttpContent(ByVal url As String) As String
Dim objWebClient As New System.Net.WebClient()
Dim objUTF8 As New UTF8Encoding()
Dim result As String = objUTF8.GetString(objWebClient.DownloadData(url))
Return result
End Function




There are currently no comments for this snippet.