I am creating an asp.net app that sends out an email. I need to attach an corporate logo in the signature. My image is displayed as
.
My code is:
LinkedResource logo = new LinkedResource(
"c:\\Data\\Misc\\Images\\CorpLogo.jpg", "image/jpeg");
logo.ContentId = "corpLogo";
logo.TransferEncoding = TransferEncoding.Base64;
AlternateView av1 = AlternateView.CreateAlternateViewFromString("<html><body>" + msgBody + "<br><img src=cid:corpLogo/><br></body></html>", null, MediaTypeNames.Text.Html);
av1.LinkedResources.Add(logo);
message.AlternateViews.Add(av1);
message.Body = msgBody;
When I hover over “logo” I can see the “contentlink” value is null.
Why would the image not be displayed?
Update
If you still haven’t sorted it, put a break on the linked resource line and check the path of the image, you might need to use server.mappath
Check here, i think this is what you are trying to do.
http://log.itto.be/?p=486
Here is a full example. Try simplify your code down to the minimum to get it working.
http://www.systemnetmail.com/faq/2.6.aspx