On Fri, 11 Aug 2017 18:28:56 +0000 (UTC) Pedro David Marco <pedrod_ma...@yahoo.com> wrote:
> Hi everybody... > When an email has a MIME part with no Content-Type header, is there any > way to force SA "guess" the format based on other criteria... file > extension, for example? Example: Content-Disposition: attachment; > filename="details.pdf"Content-Transfer-Encoding: base64 > > Thanks! > ----PedroD You should not trust what the files extension says that the file is. Also file(1) does not yet do a good enough job to be reliable this way. As for guessing, I think that the best guess that could be applied would be a test of the file to see if, once decoded, it is a utf-8 encoded, ASCII, or iso8859-X encoded text file. Failing that I would assume it is either an MS doc/ppt/spreadsheet/etc, pdf file, or pure binary. Then you could try trusting the file extension. Otherwise, it is a text file and could contain an innocent html or an uncompressed ps file or a dangerous JS infection program. Either way I'd be really careful. What is your use case? What do you intend to do with a pdf file vs. an html one? Sincerely, David