Re: "fast" save of attachments from multiple messages

2018-02-02 Thread Cameron Simpson

On 02Feb2018 04:13, Claus Assmann  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 
"mail-open-attachments", 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  (formerly c...@zip.com.au)
#!/bin/sh
#
# Unpack the MIME message named (or on stdin) in a temp direct and open.
#   - Cameron Simpson  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"


"fast" save of attachments from multiple messages

2018-02-02 Thread Claus Assmann
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).