views:

53

answers:

1

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("[email protected]")
 mail.To.Add("[email protected]")

 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)
A: 
Dim logo As New LinkedResource(Server.MapPath("images1/links/beach-icon.jpg"), "image/jpeg")
Tom