You can save all attachments via

  1. tag all attachments via hitting t
  2. ;
  3. s
  4. choose destination directory and hit a (all)

This works but has following severe side effect: you have to hit n-times enter for n attachments.

That means even if there are no file name collisions in the destination directory.

This is also documented in the Mutt FAQ.

Very inconvenient.

Some mutt users seem to recommend piping messages to munpack (example message linked). Good idea - but how to make Mutt prompt for a destination directory (as part of a munpack invoking macro)?

How do I construct such a macro? Or are there better solutions to this issue?

  • I believe the reason no one has answered your question with a mutt macro, is because <tag-pattern> does not work in attachment mode. There is, therefore, no way to programmatically tag all attachments (a necessary condition to being able to do something useful with all of them). – g33kz0r Dec 14 '16 at 19:32

You could pipe the message to ripmime, which lets you specify a destination directory on the command line...e.g.:

ripmime -i - -d ~/myfiles/

The -i - tells ripmime to read from standard input, and -d specifies a destination directory. If that's too much typing, stick it in a shell script and call that (which will also make it easier if you want to use other of ripmime's many options for controlling its behavior).

If you add a macro like this to your configuration:

macro index,pager X "<pipe-message>ripmime -i - -d "

Then you can press "X", enter a destination directory, and press <RETURN> to run the command.

  • ok, this is similar to the munpack approach - but how to nicely integrate it into mutt (via a macro that asks for a destination directory - such that you don't have to use a global directory) – maxschlepzig Apr 26 '12 at 9:29
  • I've updated my answer with an example. – larsks Apr 26 '12 at 12:57
  • ok, it is easier than I thought - because mutt macros are just a sequence of keypresses. Thus, if you just leave out a <return> in your macro then you can interactively finish the prompt. – maxschlepzig Apr 27 '12 at 8:14
  • 1
    Fantastic! Too bad I can upvote only once. What's really great about this solution is it works for multiple messages as well. Just tag 'em and ;|. – Aryeh Leib Taurog Dec 14 '14 at 15:21
  • Very nice, didn't work for multiple tagged message though, @AryehLeibTaurog you just press t and then X? – Alex Dec 11 '18 at 18:50

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.