Hi All,
I am using System.NET.Mail to automate a mailer which should embed more than one picture. I am using this code (should explain all)
Dim htmlBody As String = "<body><table border='3' width='720' height='340' ALIGN='center' ><tr><td><table background='cid:backgroundImage' border='0' width='715' height='335' ALIGN='center' ><tr><th colspan='3' height='40'></th></tr><tr ><td width='200'></td><td width='350' align='center'><font color='#808000' face='Mistral' size='8' ><b>" + dataReader.GetValue(1).ToString() + " </b><br/> </font><b><font color='#808000' face='Comic Sans MS' size='5'> on completing " + num.ToString() + " years with abc</font></b></td><td width='170'><img src='cid:employeeImage' align='absbottom ' height='150' width='150' align='absbottom ' ></td></tr></table></td></tr></table></body>"
Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString(htmlBody, Nothing, "text/html")
Dim background As New LinkedResource("C:\BirthdayandAnniversaryProject\Images\template2.JPG")
background.ContentId =
"backgroundImage"
Dim EmpImage As New LinkedResource("C:\BirthdayandAnniversaryProject\testImage1.jpeg")
EmpImage.ContentId =
"employeeImage"
Dim collection As LinkedResourceCollection = htmlView.LinkedResources()
collection.Insert(0, background)
collection.Insert(1, EmpImage)
htmlView.LinkedResources.Concat(collection)
mailMessage.AlternateViews.Add(htmlView)
I could see internet sites guiding with embedding on one picture. But when i used this code i get an exception saying
System.Runtime.InteropServices.ExternalException: A generic error occured in GDI+ at System.Drawing
Not sure if there is some other way which should be followed. PLease help. Early suggestion would be appreciated.