MAPI icon indicating copy to clipboard operation
MAPI copied to clipboard

mimetypes accepted

Open HAL0594 opened this issue 3 years ago • 1 comments

It is not specified in the documentation but I would like to know what type of mimetypes the package can read, I had problems with people who upload files with mimetype plain/text or html as msg and I would like to validate the accepted mimetypes.

HAL0594 avatar Jun 25 '21 21:06 HAL0594

I wouldn't rely on a file extension-to-mime type map to determine if the file is valid. If you see a .msg file in the wild, it's usually given application/vnd.ms-outlook. But it could also be a TNEF file, which usually has the file name winmail.dat and type ​application/ms-tnef or application/vnd.ms-tnef. (This library is untested on TNEF files so behaviour will be undefined.)

You can verify you actually have an OLE compound document that the library can attempt to parse by magic bytes 0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-cfb/05060311-bfce-4b12-874d-71fd4ce63aea

All of which is out of scope for this library

hfig avatar Jun 27 '21 02:06 hfig