[RESOLVED] embedding image not displaying in emaill using vb.net

Hi

I am trying to display an embed an image within the body of an email. The is sent, however without the image.

Below is the code:

Dim mail As New MailMessage()


mail.[To].Add("siu07aj@reading.ac.uk")


mail.From = New MailAddress("atiqisthebest@hotmail.com")


mail.Subject = "Test Email"




Dim Body As String = "<b>Welcome to codedigest.com!!</b><br><BR>Online resource for .net articles.<BR><img alt="""" hspace=0 src=""cid:imageId"" align=baseline border=0 >"


Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString(Body, Nothing, "text/html")


Dim imagelink As New LinkedResource(Server.MapPath(".") & "\uploads\CIMG1443.JPG", "image/jpg")


imagelink.ContentId = "imageId"


imagelink.TransferEncoding = System.Net.Mime.TransferEncoding.Base64


htmlView.LinkedResources.Add(imagelink)


mail.AlternateViews.Add(htmlView)


Dim smtp As New SmtpClient()


smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis
smtp.Host = ConfigurationManager.AppSettings("SMTP")
smtp.Port = 587
'smtp.EnableSsl = True


smtp.Credentials = New System.Net.NetworkCredential(ConfigurationManager.AppSettings("FROMEMAIL"), ConfigurationManager.AppSettings("FROMPWD"))


smtp.Send(mail)

In the body of the email only the following is display:

Welcome to CodeDigest.Com!!

Any idea how I can get the CIMG1443.JPG displaying?

Thanks

Hi,

is  Image is there on The path Which Your Specifiying?

Dim imagelink As New LinkedResource(Server.MapPath(".") & "\uploads\CIMG1443.JPG")


imagelink.ContentId ="test"

OR

U send Html Image Tag then define image in that

Example :- --message--<img src="http://www.server.com/1.jpg"/>

OR

http://msdn.microsoft.com/en-us/vbasic/bb630227

above link may be good Resource for you.

1 thoughts on "[RESOLVED] embedding image not displaying in emaill using vb.net"

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>