Private Function HttpContent(ByVal url As String) As String
Dim objRequest As WebRequest = System.Net.HttpWebRequest.Create(url)
Dim sr As New StreamReader(objRequest.GetResponse().GetResponseStream(),system.Text.Encoding.Default )
Dim result As String = sr.ReadToEnd()
sr.Close()
Return result
End Function
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim mailobj As New MailMessage
mailobj.Subject = "浙江省丽水市新丽日用制品有限公司"
mailobj.From = TextBox2.Text '发信人email
mailobj.To = TextBox1.Text '收信人
mailobj.Priority = MailPriority.High
mailobj.Body = HttpContent("http://www.flycatch.com")'将这个网站的首页发送到对方的地址,你可以将将你的datagrid控件的页面发送过去就可以了
mailobj.UrlContentBase = "http://www.flycatch.com"
mailobj.Body = boy.ToString
mailobj.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") 'basic authentication
mailobj.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "zc@e0578.com") 'set your username here
mailobj.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "*******") 'set your password here
mailobj.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = "mail.e0578.com"
SmtpMail.Send(mailobj)
Response.Write("<script>alert('发送成功')</" & "script>")
End Sub