Sicos1977 / MSGReader

C# Outlook MSG file reader without the need for Outlook
http://sicos1977.github.io/MSGReader
MIT License
476 stars 168 forks source link

Inline images seem to not be treated as such #327

Closed melchor629 closed 1 year ago

melchor629 commented 1 year ago

Describe the bug Inline images are not treated as inline from version 4.4.6.

To Reproduce

  1. Generate an .msg with an inline image, with HTML inside.

Expected behavior The attachment of the inline image is treated as inline.

Additional context It seems that between 4.4.5 and 4.4.6 something has changed that now the inline images are not treated as such. If I use 4.4.5, everything works fine. Upgrading to 4.4.6 or newer, it stops working.

In the example I've got, the HTML contains the following image: image

But then, the attachment has the IsInline set to false: image

Maybe related PR I've found: https://github.com/Sicos1977/MSGReader/pull/307

Cyril12740 commented 1 year ago

I have changed companies and I no longer use your package to read emails.

Do you need an email reproducing my error or that of melchor629?

Sicos1977 commented 1 year ago

I need one from @melchor629

melchor629 commented 1 year ago

Hello, sorry for the slow response :(

I've built a small email sample and small code to reproduce. Hope it helps:

using MsgReader.Outlook;

System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
using var stream = File.OpenRead(@"..\..\test.msg");
using Storage.Message msg = new Storage.Message(stream);
foreach (var attachment in msg.Attachments)
{
    if (attachment is Storage.Attachment attachmentCasted)
    {
        Console.WriteLine($"{attachmentCasted.FileName}: IsInline={attachmentCasted.IsInline} Hidden={attachmentCasted.Hidden}");
    }
}

test.msg.zip

Results with 4.4.5: image

Results with 4.4.6 (same as in 4.4.16): image

Sicos1977 commented 1 year ago

Seems to be working fine now

image

melchor629 commented 1 year ago

Cool, thanks for your work :)

M8anu commented 1 year ago

This thread is awesome seal of approval content, bending

Sicos1977 commented 1 year ago

?

zeOxx commented 1 year ago

@Sicos1977 sorry to resurrect this, but it seems like this issue has returned. this is from 3.4.1 (yes, this is an old version...) image this is from 5.2.2 image

the email i tested with: image test.msg.zip