Extracting Embedded Image from RTF (Rich Text) *.eml File

0 votes
asked May 9, 2018 by mike.coop (160 points)

I'm mainly using Rebex in an ASP.NET web application, to parse *.eml files downloaded from a third party system called inContact.

It's a very useful product and I simply love it! I've learned WAY more about the MIME format than I ever wanted to :)

The problem I'm running into has to do with RTF emails containing embedded images. HTML formatted emails with embedded images are working just fine. I replace the image link (cid:) with image data (data:) and everything looks great. (example here) But, with an RTF *.eml file, the images just appear as a period, no image at all.

Is there something else I need to do for RTF embedded images to convert the linked resource content stream into a data string?

My email body looks like it's getting formatted correctly. The image data does look a little different though, in an RTF email versus an HTML email. It's has a LOT fewer characters. It almost looks as if it's been compressed or something.

I've done a great deal of searching on the interwebs with no luck. The only thing I could find was something about it being an encrypted format or an OLE object, that may require Redemption and RDOAttachment to decrypt.

Any help would be greatly appreciated.


Applies to: Rebex Secure Mail
commented May 9, 2018 by mike.coop (160 points)
edited May 10, 2018 by mike.coop
A big THANK YOU goes out to Lukas Matyska at Rebex.  He figured out very quickly, that I was working with a .eml file, which contained invalid image data.  Replacing the image link (cid:) with image data (data:) should work just fine for all RTF emails.
commented May 10, 2018 by Lukas Pokorny (128,250 points)
That was actually Lukas Matyska - there are three Lukases in our team :-)
Thanks for letting us know you solved the issue!

1 Answer

+1 vote
answered May 9, 2018 by Lukas Pokorny (128,250 points)

We will look into this. We do aim to support RTF emails with embedded images - however, we do so by converting RTF emails to HTML emails. Unless you have switched off this conversion, RTF .eml files should actually get converted to HTML emails (with 'cid:' images). But RTF is a surprisingly complex format, so perhaps Rebex Secure Mail was unable to parse the images properly.

Would it be possible to provide us a sample RTF email with a bit of your code to demonstrate the issue? If we were able to reproduce this ourselves, we should be able to fix it as well.

If you prefer, get in touch with us at support@rebex.net instead.

commented May 9, 2018 by mike.coop (160 points)
Sorry, I should have mentioned I'm using the "MailMessage.Load()" function to initially create an object from the *.eml file.  This converts the *.eml file to HTML just fine.  I've attached a sample *.eml file for you to play with.
commented May 9, 2018 by mike.coop (160 points)
edited May 10, 2018 by mike.coop
Looks like I can't attach a file here, so I'll try sending you an email with the *.eml file attached.