Match Attachment with LinkedResource

0 votes
asked Aug 13, 2019 by 3P (270 points)
edited Aug 13, 2019 by 3P

Is there a way to match Attachments with objects in Resources array?

I iterate over Attachments and I want to find if attachment is in Resources.
I later want to read Content-Disposition inline flag from LinkedResource to determine if it was inline or not.

Applies to: Rebex Secure Mail

1 Answer

0 votes
answered Aug 14, 2019 by Lukas Pokorny (117,510 points)

Perhaps I misunderstood (please correct me if that is the case), but MailMessage.Attachments and MailMessage.Resources are two different collections, so an attachment will never be present in both (and the same applies to a linked resource). Additionally, the placement in the MIME message tree determines whether a MIME entity is an attachment or a resource.

But it looks like you might find our low-level MimeMessage/MimeEntity API useful. Unlike MailMessage, this gives you access to the original MIME message structure - see the MimeExplorer sample to get started. However, this API doesn't support TNEF messages - in order to work with these, you would have to convert them to MIME via MailMessage first.