Re: pipe attachments in mutt
On Mon, Nov 11, 2002 at 10:38:15AM +0000, Glyn Kennington wrote:
> Sandip P Deshmukh wrote:
> > > > what do i need to do so that the desired application will open with the attachment?
> > > xpdf has the correct mailcap entries that it should start automatically if
> > > you ask mutt to ``view-attach''. This command is (by default) bound to
> > > <Return> when you're in the attachments screen.
> > okay. i tried that. no luck. it opens a text reader with a lot of irrelevant characters.
>
> Is this text reader in the existing terminal (ie. the one that mutt's
> running on) or a new terminal that pops up?
opens within mutt. no new terminal.
>
> > could you possibly tell me more about mailcap entries?
>
> Well, `man mailcap' first.
will do this also. i actually searched mutt manual for mailcap. it is also fairly
exhaustive - and tiring. and understood quite a bit! but not enough for me to do it on
my own. (this was before i got this message)
>
> Things you can do: If you have any pdf files saved, type `see filename.pdf'
> and see what happens.
works perfectly! opens xpdf and the file
>
> Can you look in /etc/mailcap and /etc/mime.types for any occurrence of
> "pdf", and tell me what you find? (Also see if you have your own ~/.mailcap
> and ~/.mime.types files.)
there is no ~/.mailcap or ~/.mime-types. here is what i found on /etc/mailcap and /etc/mime:
/etc/mailcap
application/pdf; /usr/bin/xpdf '%s'; test=test "$DISPLAY" != "";
description=Portable Document Format; nametemplate=%s.pdf
image/pdf; display '%s'; test=test -n "$DISPLAY"
application/pdf; kghostview '%s' -caption "PS/PDF Viewer" ;test=test "$DISPLAY" != ""
image/pdf; konqueror '%s'; test=test "$DISPLAY" != "" && test=expr `gs --version` ">=" 3.51 >/dev/null 2>&1
application/pdf; konqueror '%s'; test=test "$DISPLAY" != "" && test=expr `gs --version` ">=" 3.51 >/dev/null 2>&1
/etc/mime.types
application/pdf pdf
> > moreover, is there a more generalized way of handling attachments? for instance, if the
> > attachment is of type pdf, open xpdf with that attachment and if the attachment is of type
> > mp3, open xmms with that attachment, etc.
>
> This is what mailcap is for. (A very simple example: When some idiot sends you
> a mail in html, and you try to view the attachment with <Return> from the
> attachments screen, does a browser get started to view the message?)
well, i have not been lucky enough to get a mail in html so far - or is it that i did not
notice it? :)
> > i will like to use | to change this default behavious. for instance, if i want to open an
> > mp3 file not with xmms but with mpg321, i will like to pipe it to mpg321 etc
>
> Piping is possible for some applications, but not all. I think mpg321 will
> read from stdin, but for some apps, if you don't want the default behaviour,
> you'll have to save the file and run the command yourself.
i think i am slowly getting a hang of it
thanx again!
sandip p deshmukh
------***--------
Reply to: