libyal / libpff

Library and tools to access the Personal Folder File (PFF) and the Offline Folder File (OFF) format
GNU Lesser General Public License v3.0
286 stars 74 forks source link

How do I determine the original fine name of an attachment? #123

Closed woheme-c closed 8 months ago

woheme-c commented 8 months ago

Hello.

I try to extract the name and type of each attachment file that is stored in the message.

Do anybody know the method? Unfortunately I can´t find a proper way.

It would be very helfpful.

Greetings

joachimmetz commented 8 months ago

PST files are MAPI databases, find the corresponding MAPI values.

Also are you sure this information is always available?

woheme-c commented 8 months ago

Hi Joachim.

Thanks for you answer.

Im sure that the information about the attachments is available. I can extract the type of the attachment (.pdf, .png, etc.) by using the magic-library.

Even if I know that pst is a MAPI database, I still don't know the method of the pypff library that gives me the value. For example, when I iterate over the parts of the attachment, I can only read out the number of items, but it is not clear from the library how I can get the items or records themselves. Maybe I have some kind of an error in my thinking. With the "read_buffer" there is only the binary file of the file itself as far as I can see. I cannot read the filename from it. In any case, I can't find a method here either. Is there even this possibility of reading out the file types and file names in the library?

Greetings

joachimmetz commented 8 months ago

I can extract the type of the attachment (.pdf, .png, etc.) by using the magic-library.

you mean mime type? that is necessary for encoding, file name is not required.

Note that pypff is WIP, per https://github.com/libyal/libpff/issues/2, closing issue as duplicate.

woheme-c commented 8 months ago

I think you didnt get the question, unfortunately.

every mime file carries information about type and also the name of the attachement. The question is, how to extract this informations. What is the method of the library with python.

I allready extracted the type with the magic library because I didnt find the method with pypff. Same problem with the file-name.

greetings

joachimmetz commented 8 months ago

I think you didnt get the question, unfortunately.

Then rephrase it, be specific about what you are asking. I cannot look into your thoughts.

What do you mean with "mime file"?

I allready extracted the type with the magic library because I didnt find the method with pypff. Same problem with the file-name.

As I said PST are MAPI databases, you need to find the right value. If it is stored.

mhechthz commented 5 months ago

Is there any new development in this question? Using the Python library I cannot figure out the name of the attachment. So I also used magic library but it is quite difficult to guess the type of the attachment. Furthermore I have to generate uui4 random names for the files to store it on disc. In the original E-Mail the name is always available, so should be stored somewhere in the message.

If there could be a method like attachment.get_name() it would be quite helpful. Or did I only miss the right way to get the name?