It is certainly possible to launch a GUI application such as
OpenOffice.org or Acrobat Reader to view Word and PDF email
attachments in Mutt. But Mutt users aren't always
using a graphical desktop, so it's handy to be able
to view these documents as text, right inside the message itself.
Here's how to do it. First, you need to edit the
Mutt configuration file. The default configuration file is usually
/etc/Muttrc, but you'll most
likely want to create your own even if you do it by copying the
default and modifying it. Mutt lets you define your user
configuration file as either ~/.muttrc or
~/.mutt/muttrc. Modify your personal Mutt
configuration file to point to a custom mailcap
file. For example:
set mailcap_path="~/mailcap.mutt"
Then edit the ~/mailcap.mutt file to include
these two lines:
application/pdf; pdftohtml -q -stdout %s | w3m -T text/html; copiousoutput
application/msword; wvWare -x /usr/lib/wv/wvHtml.xml %s 2>/dev/null | w3m -T text/html;
copiousoutput
Now all attached PDF and Microsoft Word documents will appear within
the text of the email. Granted, the formatting isn't
as pretty as when you view Word or PDF documents [Hack #52] and [Hack #53], because all the output is
piped into Mutt's own display, and not in a
specialized pager, such as elinks or
w3m. But you can still read the content of the
attached file. And if it interests you enough to read it in a better
format, you can save the file and read it with whatever program you
want—including one of the scripts in the previously mentioned
hacks.