Attachment.FileName returnes diffferent than what I see in mail client

0 votes
asked Aug 9, 2019 by 3P (300 points)

I have a mail with 3 attachments with same name - let's say image.jpg. But FileName and DisplayName for those attachments return image.jpg, image(1).jpg, image(2).jpg.
I also have other e-mail with winmail.dat attached where there are two files with same name inside - [Untitled].pdf and for both of those FileName returns [Untitled].pdf.

I don't know what is the convention and how should I get attachment's name.

Applies to: Rebex Secure Mail

1 Answer

0 votes
answered Aug 12, 2019 by Lukas Pokorny (123,890 points)

DisplayName property is supposed to reflect the original file name value (as present in the email data), while FileName should be "safe" version of it (meaning it's a valid file name and not a duplicate).

So based on your description, it looks like the first mail really did contain image.jpg, image(1).jpg and image(2).jpg files, while the other mail might not be processed by Rebex Mail properly.

We'll look into this. An issue like this could easily got overlooked because TNEF/winmail.dat mail messages have been quite rare for years. If you could share a sample of these emails, it would be helpful. Thanks for letting us know about this!

commented Aug 12, 2019 by 3P (300 points)
I have sent an example e-mail for case where (1), (2) is returned for FileName and DisplayName.
commented Aug 13, 2019 by Lukas Pokorny (123,890 points)
Thanks, we have now succeeded in reproducing thtis. The DisplayName property is not behaving as intended - it should contain the original file name (same in those three cases). We'll fix this as well. Thanks for letting us know!

Update: This has been fixed in 2019 R3.2 release: