1

I receive emails with PDF attachments that have the MIME type "text/pdf". This is obviously not good, but some mail clients are doing that...

The problem is that saving such an attachment in Mutt leads to a file on the disk that cannot be opened by a PDF viewer. The file size is indeed different by a few bytes from what it should be.

How can I save such attachments?

1

Never come across a PDF as text/pdf, but presumably Mutt is trying to do a line ending conversion (e.g., CRLF → LF).

Easiest way to stop it would seem to be to (in the Attachments screen) edit the MIME type. By default, that's bound to ^E. Then save it.

(untested, as I've never seen a text/pdf PDF attachment.)

0

I use pdftotext to render PDFs in mutt.

In your ~/.mutt/muttrc define a ~/.mutt/mailcap path:

# define mailcaps
set mailcap_path=~/.mutt/mailcap:/etc/mailcap
set mailcap_sanitize

In your ~/.mutt/mailcap:

text/pdf; pdftotext %s -; copiousoutput; needsterminal; description="Adobe PDF Doc"
  • Normally the mailcap would have "application/pdf" as the mime type, but I used text/pdf in my example. May want to add both. – Chipster May 23 '14 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.