NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mailcap and Microsoft OOXML



Hi,

On Mon, Mar 18, 2019 at 03:47:31PM +0000, Steve Blinkhorn wrote:
> Can a mailcap entry make an attachment with these headers:
> 
> Content-Type: application/octet-stream
> Content-Transfer-Encoding: base64
> Content-Description: Microsoft OOXML
> Content-Disposition: attachment; filename="acctkey.xlsx"
> 
> be read with scalc?   More generally, is there a way of parsing the
> Content-Description header along with the Content-Type to cope with
> application/octet-stream attachyments?  I get a lot of spreadsheet
> attachments, some of which start up scalc and some don't and have to
> be manually saved and opened outside the mail reader.
> 
> Or is this something specific to individual mail readers

Well, yes, it is. The official way to signal to the mailreader what
type is inside, is the field - surprise! - Content-Type: 

With mutt, you can set in your .muttrc:

mime_lookup application/octet-stream application/x-force-download application/vn
d* application/force-download

to make it use the lookup table in $HOME/.mime.types and
/usr/pkg/etc/mime.types and /usr/pkg/share/mime.types

to guess the mime type from the file name suffix. (xlsx)

The more robust way could be to send those content-types to a script that
parses the data using file(1) or something similar and calls an application
of your choice.

Btw - you could maybe use formail (from the package procmail) to manipulate
content-type depending on content-description if it is
application/octet-stream. Don't know how well this works for structured
levels of mime headers.

> (being of Jurassic vintage I use elm).

Used to be same here, but a while after Michael Elkins got tired
of publishing patches to elm and started publishing a whole MUA,
I switched without too much pain ;-) So you won't find all modern
features there.

	-is


Home | Main Index | Thread Index | Old Index