1

I am currently using a string to embed a base64 image in email via EWS but the embeded images is not showing up in my outlook client when i receive the email.

If i save the email source it is viewable in my browser.

static string str = @"<head><meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" /></head><body><img src=""data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="" /></body></html>";

Is it possible to embed images into a HTML email message in this method?

Best Regards

Chris

Christopher Leach
  • 568
  • 1
  • 5
  • 16
  • 2
    What do you mean by "its not showing"? How are you observing that it isn't working? In which "viewer" are you looking at the HTML output? Have you instructed EWS to "show pictures" or whatnot? – Cᴏʀʏ Sep 24 '12 at 13:58
  • I have updated my question to hopefully help get some answers. Thanks for the response and kind help. – Christopher Leach Sep 24 '12 at 14:23
  • OK. apparently spammers have screwed this method up for us nice developers and email clients wont show the images. :( Nice article http://www.b2bemailmarketing.com/2008/07/test-shows-embe.html surely if you whitelist a sender this type of email/image attaching should be allowed. Ohwell. back to the drawing board! – Christopher Leach Sep 24 '12 at 14:41
  • I just tried saving your source from above into an HTML file and viewed it in Chrome. I see basically a red bullet point. Would that be what you were expecting? Have you thought about hosting the images somewhere instead of embedded them or attaching them? – Cᴏʀʏ Sep 24 '12 at 14:43
  • Also, have you seen this Q&A? http://stackoverflow.com/questions/9110091/base64-encoded-images-in-email-signatures – Cᴏʀʏ Sep 24 '12 at 14:47
  • Thanks again Cory, Yeah it was just a red dot to test. I'm developing a WPF client that allows a user to generate a mail merge type bulk email client using a WYSIWYG style editor and it attaches the images in that method. I'll try writing some custom logic either to send the images to a web server when the import/place the image or use the CID/Attachment method with EWS when they send. Or better yet, find a different HTML WYSIWYG editor. Thanks for your support. – Christopher Leach Sep 24 '12 at 14:53

1 Answers1

3

Data URI scheme may be not supported by the receiving party: What is Data URI support like in major email client software?

Consider using MIME related (cid protocol) to send html email with embedded images. I believe it is far better supported. I'm not sure if it can be easily done with SmtpMail.

Community
  • 1
  • 1
Pawel Lesnikowski
  • 6,264
  • 4
  • 38
  • 42