Mailcap File für Mail Client Mutt
Geschrieben von Eric Scheibler am 08.08.2013
Dieser Beitrag beinhaltet mein Mailcap File für den Konsolen Mail Client Mutt. Damit ist es möglich, u.A. PDF, DOCX und HTML Anhänge direkt aus Mutt heraus zu öffnen.
Nach dem Download der mailcap Datei muss diese in den Ordner ~/.mutt kopiert und das Mailprogramm neu gestartet werden. Danach öffnet man einen Anhang, indem man zur gewünschten Mail navigiert und mit “v” die Dateianhangliste aufruft.
Download: mailcap
# mailcap file for mutt
# Author: Eric Scheibler
# Last update: 2022-08-03
#
# copy into ~/.mutt/
# then add the following lines to ~/.mutt/muttrc
# ```
# set mailcap_path="~/.mutt/mailcap"
# bind attach <return> view-mailcap
# ```
#
# general hint
# find out unknown file extension mime type:
# in the mutt index view, go to the mail and press "|"
# then enter the command: grep Content-Type
# .txt
text/plain; cat %s; copiousoutput
# .html
# sudo aptitude install w3m
# interactive: open in w3m from attachments menu to click links in emails
text/html; w3m -T text/html -O utf-8 %s;
# non-interactive: used in auto-view and reply
text/html; w3m -dump -T text/html -O utf-8 %s; copiousoutput;
# .rtf
# sudo aptitude install unrtf
application/rtf; unrtf --text %s; copiousoutput
text/rtf; unrtf --text %s; copiousoutput
# .pdf
# My ocr script extracts text from pdf and images:
# Link: http://eric-scheibler.de/en/blog/2015/04/script-to-extract-text-from-images-and-scanned-pdf-files/
application/pdf; ocr -r layout -s %s; copiousoutput
application/vnd.fdf; ocr -r layout -s %s; copiousoutput
# or use pdftotext:
# sudo aptitude install poppler-utils
#application/pdf; pdftotext -q -layout %s -; copiousoutput
#application/vnd.fdf; pdftotext -q -layout %s -; copiousoutput
# images
image/*; ocr -s %s; copiousoutput
# calendar (.ics)
text/calendar; khal import -a calendar %s;
text/X-vCalendar; khal import -a calendar %s;
# open office
# .odt
# sudo aptitude install odt2txt
application/vnd.oasis.opendocument.text; odt2txt %s; copiousoutput
# microsoft office
# .doc
# sudo aptitude install antiword
application/msword; antiword %s; copiousoutput
# .docx (since Office 2010)
application/vnd.ms-word.document.12; pandoc -f docx -t plain %s; copiousoutput
application/vnd.openxmlformats-officedocument.wordprocessingml.document; pandoc -f docx -t plain %s; copiousoutput
# .xls
# sudo aptitude install catdoc
application/vnd.ms-excel; xls2csv -x %s -s cp1252 -d utf-8; copiousoutput