代码这样写,但好像很多邮箱都不支持
Dim client As New System.Net.Mail.SmtpClient()
client.Host = "smtp.126.com"
client.Credentials = New System.Net.NetworkCredential("lin_hailun@126.com", "6849338.")
client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network
Dim message As New System.Net.Mail.MailMessage("lin_hailun@126.com", "2450314695@qq.com")
message.Subject = "图文邮件测试"
message.BodyEncoding = System.Text.Encoding.UTF8
message.IsBodyHtml = True
Dim body As String = "<html><body>正文内容</body></html>"
Dim content As String
'处理图片
Dim bmp As new Bitmap("d:\test.jpg")
Dim ms As new System.Io.MemoryStream()
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
Dim arr(ms.Length) As Byte
ms.Position = 0
ms.Read(arr, 0, ms.Length)
ms.Close()
Dim strbaser64 As String = Convert.ToBase64String(arr)
content &= "这是文字"
content &= "<DIV><IMG src='data:image/png;base64, " & strbaser64 & "'></IMG></DIV>"
content &= "也是文字"
message.Body = body.Replace("正文内容", content)
Try
client.Send(message)
msgbox("发送成功")
Catch ex As Exception
msgbox("发送失败:" & ex.message)
End Try