Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo User (http://www.linux-archive.org/gentoo-user/)
-   -   OT: How to make mutt open files by *EXTENSION*? (http://www.linux-archive.org/gentoo-user/686721-ot-how-make-mutt-open-files-extension.html)

"Walter Dnes" 07-23-2012 09:43 PM

OT: How to make mutt open files by *EXTENSION*?
 
My ISP emails invoices+receipts as PDF files. Thay made a change in
the "mime type" earlier this year that makes things more difficult...

Before
======
[-- Attachment #2: blah_blah_blah.pdf --]
[-- Type: application/pdf, Encoding: base64, Size: 47K --]

[-- application/pdf is unsupported (use 'v' to view this part) --]

After
=====
[-- Attachment #2: blah_blah_blah.pdf --]
[-- Type: application/octet-stream, Encoding: base64, Size: 79K --]

[-- application/octet-stream is unsupported (use 'v' to view this part) --]

With "Type: application/pdf" I hit "v" and epdfview brought up the
document. With "Type: application/octet-stream" I have to save the
attachment and manually open with epdfview. Mime-type is useless in
this situation. Is there a way to force the file to be opened based on
extension rather than mime type?

--
Walter Dnes <waltdnes@waltdnes.org>

Todd Goodman 07-23-2012 10:13 PM

OT: How to make mutt open files by *EXTENSION*?
 
* Walter Dnes <waltdnes@waltdnes.org> [120723 17:48]:
> My ISP emails invoices+receipts as PDF files. Thay made a change in
> the "mime type" earlier this year that makes things more difficult...
>
> Before
> ======
> [-- Attachment #2: blah_blah_blah.pdf --]
> [-- Type: application/pdf, Encoding: base64, Size: 47K --]
>
> [-- application/pdf is unsupported (use 'v' to view this part) --]
>
> After
> =====
> [-- Attachment #2: blah_blah_blah.pdf --]
> [-- Type: application/octet-stream, Encoding: base64, Size: 79K --]
>
> [-- application/octet-stream is unsupported (use 'v' to view this part) --]
>
> With "Type: application/pdf" I hit "v" and epdfview brought up the
> document. With "Type: application/octet-stream" I have to save the
> attachment and manually open with epdfview. Mime-type is useless in
> this situation. Is there a way to force the file to be opened based on
> extension rather than mime type?
>
> --
> Walter Dnes <waltdnes@waltdnes.org>

I think you could use something like mutt.octet.filter (There's a perl
version at http://www.davep.org/mutt/mutt.octet.filter.pl) to handle
application/octet-stream mime types.

It uses file to try to determine the proper type and can then use
whatever is in your mailcap to determine what to run.

It should be pretty easy to extend it to match on filename if you really
wanted to.

Todd

Terry 07-24-2012 04:37 AM

OT: How to make mutt open files by *EXTENSION*?
 
I may be mistaken (away from computer atm) but doesn't mutt use mailcap? I believe I use /etc/mailcap but you could also use per user files, /home/user/.mailcap to adjust your attachment handling. There's lots of guides on the web.



--

Sent from my Android phone with K-9 Mail. Please excuse my brevity. And my typing mistakes.

Todd Goodman <tsg@bonedaddy.net> wrote:
* Walter Dnes <waltdnes@waltdnes.org> [120723 17:48]:
> My ISP emails invoices+receipts as PDF files. Thay made a change in
> the "mime type" earlier this year that makes things more difficult...
>
> Before
> ======
> [-- Attachment #2: blah_blah_blah.pdf --]
> [-- Type: application/pdf, Encoding: base64, Size: 47K --]
>
> [-- application/pdf is unsupported (use 'v' to view this part) --]
>
> After
> =====
> [-- Attachment #2: blah_blah_blah.pdf --]
> [-- Type: application/octet-stream, Encoding: base64, Size: 79K --]
>
> [-- application/octet-stream is unsupported (use 'v' to view this part) --]
>
> With "Type: application/pdf" I hit "v" and epdfview brought up the
> document. With "Type: application/octet-stream" I have to save
the
> attachment and manually open with epdfview. Mime-type is useless in
> this situation. Is there a way to force the file to be opened based on
> extension rather than mime type?
>
> --
> Walter Dnes <waltdnes@waltdnes.org>

I think you could use something like mutt.octet.filter (There's a perl
version at http://www.davep.org/mutt/mutt.octet.filter.pl) to handle
application/octet-stream mime types.

It uses file to try to determine the proper type and can then use
whatever is in your mailcap to determine what to run.

It should be pretty easy to extend it to match on filename if you really
wanted to.

Todd

Henry Gebhardt 07-24-2012 07:49 AM

OT: How to make mutt open files by *EXTENSION*?
 
On Mon, Jul 23, 2012 at 06:13:45PM -0400, Todd Goodman wrote:
> * Walter Dnes <waltdnes@waltdnes.org> [120723 17:48]:
> > My ISP emails invoices+receipts as PDF files. Thay made a change in
> > the "mime type" earlier this year that makes things more difficult...
> >
> > Before
> > ======
> > [-- Attachment #2: blah_blah_blah.pdf --]
> > [-- Type: application/pdf, Encoding: base64, Size: 47K --]
> >
> > [-- application/pdf is unsupported (use 'v' to view this part) --]
> >
> > After
> > =====
> > [-- Attachment #2: blah_blah_blah.pdf --]
> > [-- Type: application/octet-stream, Encoding: base64, Size: 79K --]
> >
> > [-- application/octet-stream is unsupported (use 'v' to view this part) --]
> >
> > With "Type: application/pdf" I hit "v" and epdfview brought up the
> > document. With "Type: application/octet-stream" I have to save the
> > attachment and manually open with epdfview. Mime-type is useless in
> > this situation. Is there a way to force the file to be opened based on
> > extension rather than mime type?
>
> I think you could use something like mutt.octet.filter (There's a perl
> version at http://www.davep.org/mutt/mutt.octet.filter.pl) to handle
> application/octet-stream mime types.
>
> It uses file to try to determine the proper type and can then use
> whatever is in your mailcap to determine what to run.
>
> It should be pretty easy to extend it to match on filename if you really
> wanted to.

There is also stuff in portage to handle it, like
dev-perl/File-MimeInfo, with which your mailcap can look like this:

application/octet-stream; mimeopen %s

It uses the file extension by default, but can use magic, too.


Cheers,

Henry

Todd Goodman 07-24-2012 06:00 PM

OT: How to make mutt open files by *EXTENSION*?
 
* Terry <ny6p01@gmail.com> [120724 00:44]:
>
> I may be mistaken (away from computer atm) but doesn't mutt use mailcap? I believe I use /etc/mailcap but you could also use per user files, /home/user/.mailcap to adjust your attachment handling. There's lots of guides on the web.
>
[..]

Hi Terry,

Yes, it uses mailcap (/etc/mailcap or ~/.mailcap.)

His problem is they've started sending his PDF as
application/octet-stream which needs further investigation to determine
what it really is.

Todd

Philip Webb 07-24-2012 07:01 PM

OT: How to make mutt open files by *EXTENSION*?
 
120724 Todd Goodman wrote:
> His problem is they've started sending his PDF
> as application/octet-stream
> which needs further investigation to determine what it really is.

I suspect the OP's ISP is the same as mine (we live in the same city),
in which case I recommend what I do -- also using Mutt -- ,
ie 'v'iew the list of attachments, 'c'opy the PDF to some local dir
-- I actually keep them all under ~/biz/ilog/<myname>.pdf --
& read the details there with Evince (or his choice).
After that, he can simply delete the original e-mail from the ISP.

The value of Gentoo is that you can keep things really simple.

--
========================,,======================== ====================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca

Grant Edwards 07-24-2012 10:00 PM

OT: How to make mutt open files by *EXTENSION*?
 
On 2012-07-24, Todd Goodman <tsg@bonedaddy.net> wrote:
> * Terry <ny6p01@gmail.com> [120724 00:44]:
>>
>> I may be mistaken (away from computer atm) but doesn't mutt use mailcap? I believe I use /etc/mailcap but you could also use per user files, /home/user/.mailcap to adjust your attachment handling. There's lots of guides on the web.
>>
> [..]
>
> Hi Terry,
>
> Yes, it uses mailcap (/etc/mailcap or ~/.mailcap.)
>
> His problem is they've started sending his PDF as
> application/octet-stream

AFAICT, that's been standard operating breakage for Outlook+Exchange
since bits were invented. I've been getting PDF files typed as
application/octet-stream from Outlook users for 15 years.

--
Grant Edwards grant.b.edwards Yow! I guess it was all a
at DREAM ... or an episode of
gmail.com HAWAII FIVE-O ...


All times are GMT. The time now is 06:54 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.