Showing inline pictures in HTMLBody

0 votes
asked Feb 18, 2011 by Stefan Wagner (150 points)
edited Jul 12, 2012


I'm currently using a trial version of your secure mail components, trying to write a webmail prototype. So far all have been good, but I have encountered problems with inline pictures.

I can stream out the content from the resources-property of the MailMessage-object just fine, but when applying the content of the BodyHTML-property to innerhtml of a 'div', I only get an outline of the picture, but without the picture itself.

Have I misunderstood something? Should I save the inline pictures to disk before they can be shown?

I have tried in IE, Firefox and Chrome.

1 Answer

0 votes
answered Feb 18, 2011 by Lukas Matyska (61,230 points)
edited Jul 12, 2012
Best answer

Saving linked images to disk is not necessary, but it is faster for a client (but more difficult for you).

How to display linked images without saving them to disk is show in this sample application (see the ShowMessageDetail method).

Basically you always need to replace original HTML body fragments <img src="cid:XYZ"> with something like this <img src="/images/XYZ"> or this <img src="/GetImage.aspx?cid=XYZ">. The first replacement is needed when you save linked image to disk. The second replacement is needed when you send the linked image to a client on the fly.

commented Feb 21, 2011 by Stefan Wagner (150 points)
Had a bad feeling this would be needed, so just implemented it like that. But did really not like the idea of changing the body. Never worked with e-mail applications before, guess I just hoped inline pictures would be something beautiful and a magically easy thing. Thanks a lot for the reply - this issue were the last, so looks like we will upgrade.