0
我目前正在發送電子郵件編程在我的網頁,電子郵件工作正常,但我也想附加一個gridview到電子郵件正文。Attatch Gridview到電子郵件正文VB.NET
這是我的VB代碼我有發送電子郵件到目前爲止...
Dim Uname As String = Page.User.Identity.Name.Substring(Page.User.Identity.Name.IndexOf("\") + 1)
strFm = Uname + "@Inscapepeople.co.uk"
If strTo <> "" Then
Dim insMail As New System.Net.Mail.MailMessage(New MailAddress(strFm), New MailAddress(strTo))
With insMail
For Each y As String In strToREST.Split(";")
If y = "" Then
Else
.CC.Add(y)
End If
Next
.Subject = subject
.Body = Greet + "<br />" + "<br />" + bodyTxt.Text + "<br />" + PName + "- " + PNum + "<br />" + "<br />" + "The Required Date was: " + ReqDateNow.Text + " ,The Required Date is now: " + ReqDateAfter.Text + "<br />" + "Regards," + "<br />" + "<br />"
.IsBodyHtml = True
Sig = Uname
If Sig.ToLower = "djones" Then Sig = "GBennett"
Dim source As String = Path + Sig + ".jpg"
If System.IO.File.Exists(source) = False Then
Msgbox.ShowAlertMessage("Signature not found, but the email was still sent.")
Else
Dim lr As New LinkedResource(source)
lr.ContentId = "Signature"
Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString(insMail.Body + "<img width=""500"" height=""400"" src=cid:Signature>", Nothing, "text/html")
htmlView.LinkedResources.Add(lr)
.AlternateViews.Add(htmlView)
End If
End With
Dim smtp As New System.Net.Mail.SmtpClient
smtp.EnableSsl = False
smtp.Host = "192.168.50.2"
smtp.Port = 25
smtp.UseDefaultCredentials = True
smtp.Send(insMail)
我在網上搜索周圍,我找不到任何東西來幫助我,我在想,如果我能得到一些幫助有了這個,先謝謝你。
任何幫助都將不勝感激。