[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using mimetype and file to guess content-type
From: |
Sergey Poznyakoff |
Subject: |
Re: Using mimetype and file to guess content-type |
Date: |
Tue, 08 Jun 2021 07:14:32 +0200 |
Jean Louis <bugs@gnu.support> ha escrit:
> In order to guess the content-type, I am using these functions. It
> appears that Perl's `mimetype' works so much better than `file', for
> example it will give tell for .gpg file that it is pgp encrypted, but
> `file' will tell it is application octet stream.
That depends only on the set of "magic" files your installation of
"file" is using (/etc/file/magic).
> Overall I am replacing some `mutt' based functions with `mail' and
> that works well so far. But `mutt' on the command line in batch mode
> does recognize the attached file's content type while `mail' does not.
>
> I understand that `mail' is asking for the content-type to be provided
> by user, though question is if some mechanism exists in C libraries
> that the content-type gets automatically recognized if not supplied on
> the command line?
Yes, mailutils provides mailcap functions designed expressly for that
purpose. It would be nice to modify mail to use them.
Regards,
Sergey