In one of my mails (file extension “msg”) an attachment is loaded into the MailMessage.Attachments with the DispositionType “Inline” although it is attached as a file.
When creating a new mail with the same attachment it has the correct DispositionType (“Attachment”).
I encountered this issue with some different mails and attachments of different file types but sadly I don’t have a reliable reproduction. How does Gembox determine if an attachent is inlined?
I need the information to handle attached files for a mail and I need to ignore inlined attachments like pictures with embedded links in a signature.
Is there another way to differentiate whether an attachment is embedded in the mail text?
For further investigation I can provide you with one of the mails, if that helps.
We investigated the attachment in question and we believe that the type is correct even though it is not part of the body.
You see, the thing is that this attachment specifies the PidTagAttachContentId property which is an identifier to be used as a reference on the message’s HTML body. So if it has it, GemBox.Email interprets it as a potential inline attachment.
Perhaps as a workaround, you could check if that Content ID exists in the HTML body.
For example, something like this:
I tried your workaround and it looks good at so far, except one (maybe unrelated?) “issue”: sometimes I’m getting an attachment with disposition type Attachment, although it isn’t a “real” attachment. In this case I get an attachment called “Body.rtf” which contains the RTF body of the MailMessage. Is this also by design? Is there a better way to ignore this “fake” attachment than skipping any attachment named "Body.rtf?
I tried the workaround too, but I received a NullReferenceException on the message.BodyHtml property. I loaded the same mail that I sent you for reproduction.
Is this due to using the Free License limitations or is the loading process different to receive the BodyHtml?