On 02Feb2018 04:13, Claus Assmann <mutt+us...@esmtp.org> wrote:
Is there some fast way to save the attachments from multiple messages?
That is, without going to every individual message, viewing and
then saving the attachments? I can tag the attachments in a single
message and save them easily, but seemingly not for multiple messages
(AFAICT). Something like a "save attachments" option (after tagging
the messages) or some "clever" macro?

This would be useful as I sometimes get many messages with one
attachment each instead of one message with many attachments (e.g.,
to avoid messages that are too large for some MTA configurations).

If you have the munpack or metamail commands on your system you can use them to unpack messages, extracting the attachments. If you're standing in the directory where you want the attachments extracted you could:

 - tag the messages

 - type ";|munpack" or ";|metamail -w -x" to extract the contents

You will need the setting pipe_split=yes to run each message on its own.

Once sorted you'll probably want to make a macro to make this easy after tagging the messages. You might also want to have a preferred place to extract things.

For example, on a single message basis I've got "V" bound to "<pipe-message>mail-open-attachments<enter>", which I've attached. I'm on a Mac, so that makes a scratch directory, unpacks the message with munpack, then opens the directory in the Finder for me to fiddle with. Hack to suit.

Cheers,
Cameron Simpson <c...@cskk.id.au> (formerly c...@zip.com.au)
#!/bin/sh
#
# Unpack the MIME message named (or on stdin) in a temp direct and open.
#   - Cameron Simpson <c...@cskk.id.au> 16nov2015
#

set -uex

outdir=$HOME/var/mail-attachments

cmd=$(basename "$0")
unpackdir=$outdir/$(datecode)-$$

mkdir "$unpackdir"
cat ${1+"$@"} | munpack -C "$unpackdir" -t
( cd "$unpackdir"; fixexts * ) || :
open "$unpackdir"

Reply via email to