0
您好,我正在使用SendGridMessage()对象与VB.net通过SendGrid SMTP服务器发送电子邮件。
我有我要在邮件正文发送.mht文件...正文电子邮件中发送mht文件
我知道这是可能在邮件正文中发送纯HTML,但是当我读了MHT文件,并把它放在邮件正文,似乎都搞砸这样的: ,我想看看它是这样的:
这是我的代码:
Dim myMsg As New SendGridMessage()
myMsg.AddTo("[email protected]")
myMsg.From = New MailAddress(ApiEmail, ApiUserName)
myMsg.Subject = "Test with MHT file"
myMsg.Html = ""
Dim fso As New FileSystemObject
Dim ts As TextStream
'Open file.
ts = fso.OpenTextFile(sPath)
'Loop while not at the end of the file.
Do While Not ts.AtEndOfStream
myMsg.Html += ts.ReadLine
Loop
'Close the file.
ts.Close()
Dim credentials = New NetworkCredential(ApiUser, ApiKey)
Dim transportWeb = New Web(credentials)
transportWeb.DeliverAsync(myMsg)