开发者

Problem with embedded attachments in Mail - Mac OSX - fine everywhere else

This code works fine for absolutely every mail client except Mail for OSX, which just inserts a plain grey icon titled "Mail Attachment (2.6kb)"

Can anyone see what might be missing to make it work in all mail clients.??

Dim mail As New MailMessage()

 mail.From = New MailAddress("me@mycompany.com")
 mail.To.Add("tom@myaddress.com")

 mail.Subject = "This is an email"

 mail.IsBodyHtml = True
 mail.开发者_开发百科Priority = MailPriority.Normal

 Dim plainView As AlternateView = AlternateView.CreateAlternateViewFromString("This is my plain text content, viewable by those clients that don't support html", Nothing, "text/plain")

 Dim logo As New LinkedResource(Server.MapPath("images1/links/beach-icon.jpg"))

 logo.ContentId = "embeddedimage"

 Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString("<p>Here is an embedded image.</p> <p><img alt='' hspace='0' src='cid:embeddedimage' align='baseline' border='0' ></p> <p>It's pretty awesome</p>", Nothing, "text/html")

 htmlView.LinkedResources.Add(logo)

 mail.AlternateViews.Add(plainView)
 mail.AlternateViews.Add(htmlView)

 Dim smtp As New SmtpClient("localhost") 'specify the mail server address
 smtp.Send(mail)


Dim logo As New LinkedResource(Server.MapPath("images1/links/beach-icon.jpg"), "image/jpeg")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜