Overblog Follow this blog
Edit post Administration Create my blog
Balavardhan Reddy Narani

How to Display Images in the Mail body as Thumbnails

March 7 2009 , Written by Balavardhan Published on #ASP.Net

Send Mail with Images as Thumbnails


If the Image existed in you Server,

Dim mailMessage As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage()
'Baic Mail Infomation
mailMessage.From = New System.Net.Mail.MailAddress("from@gmail.com")
mailMessage.To.Add("to@gmail.com")

mailMessage.Subject = "Mail Subject"
'Create two views, one text, one HTML.
Dim plainTextView As System.Net.Mail.AlternateView = System.Net.Mail.AlternateView.CreateAlternateViewFromString("body Infomation", Nothing, "text/plain")


Dim htmlView As System.Net.Mail.AlternateView = System.Net.Mail.AlternateView.CreateAlternateViewFromString("body Infomation" + "image Path", Nothing, "text/html")
'Add two views to message.
mailMessage.AlternateViews.Add(plainTextView)
mailMessage.AlternateViews.Add(htmlView)
'Send message
Dim smtpClient As New System.Net.Mail.SmtpClient()
smtpClient.Send(mailMessage)

****Note - image path : &lt img src='http://www.mydomain.com/images/my_image.gif' / &gt

Share this post

Repost 0

Comment on this post