in reply to Comparing different MIME type checking modules

They all look they are generating 'legal' MIME information. (Although I'm willing to be proved wrong on that.) The question is which produces the best MIME-type for your files. From what you've shown, File::MIMEInfo::Magic seems to do a fairly good job on a wide variety of files, although it is possible one of the others does a better job on the files you most commonly send.

As for matching what your email client generates: It's got it's own system for doing this, and it may or may not generate a better MIME type for any specific file.

Basically, there may be several different MIME types that could be used for a specific file, depending on the level of specificity available to the software on either end. In general more specific is better, but I don't think it is an error to list a more generic type as long as it still correctly describes the file.

  • Comment on Re: Comparing different MIME type checking modules

Replies are listed 'Best First'.
Re^2: Comparing different MIME type checking modules
by saurabh.hirani (Beadle) on May 22, 2009 at 08:15 UTC

    I agree that every email client has its own system for adding the "Type" header but what shook me was the fact that if I were to write a perl program which scans through an email and says whether it contains a .gz file or not, I would rely on the 'Content-type' header and I would probably search for 'application/x-gzip'.

    Now, if the sender has created the mail using File::MimeInfo then my program would say there is no .gz file in the mail as it could not find 'application/x-gzip' because the 'Content-type' header was 'application/x-compressed-tar'. My best bet in this case would be to know the different 'Content-type' headers for .gz file and match against each of them i.e. match against application /x-gzip, if that fails match against applicatio/x-compressed-tar, If that fails maybe assume its not a .gz file.