Greg Reagle wrote:
> May I see the single script please?
Attached.
My workflow is usually similar to this:
1. Download mails and list unread: `mblaze s -d`
2. Read them: `mblaze s -v 1:5`
3. Reply to a message: `mblaze s -r 4`
There are separate arguments to list sent, unread, archived, etc., mails,
as well as to remove messages and save attachments.
I have two accounts, this is handled as well.
The script can somehow be improved I believe.
--
caóc
#!/bin/sh
export BASENAME="$(basename $0)"
export MBLAZE_NOCOLOR=1
usage() {
printf "usage: %s [s|d] [-ar|-d|-h|-l|-la|-lar|-ls|-r|-rm|-strm|-t|-trm|-v|-vx|-w]\n" "$BASENAME" >&2
exit 0
}
sss() {
msort -d | mseq -S | mscan
}
if [ $# -lt 2 ]; then
usage
exit 1
fi
case $1 in
d)
export MBLAZE=$HOME/.mail/c9x
popbox=disr
;;
s)
export MBLAZE=$HOME/.mail/snopyta
popbox=snopyta
;;
*)
usage
exit 1
esac
shift
case $1 in
-ar)
mrefile $2 $MBLAZE/archive
exit 0
;;
-d)
mpop $popbox
minc -q $MBLAZE/inbox
mlist -st $MBLAZE/inbox | sss
exit 0
;;
-l)
mlist -st $MBLAZE/inbox | sss
exit 0
;;
-la)
mlist -t $MBLAZE/inbox | sss
exit 0
;;
-lar)
mlist $MBLAZE/archive | sss
exit 0
;;
-ls)
mlist $MBLAZE/sent | sss
exit 0
;;
-r)
mrep $2
exit 0
;;
-rm)
mflag -T $2
exit 0
;;
-strm)
mlist -T $MBLAZE/sent | xargs rm
exit 0
;;
-t)
mlist -T $MBLAZE/inbox | sss
exit 0
;;
-trm)
mlist -T $MBLAZE/inbox | xargs rm
exit 0
;;
-v)
mshow -B -h from:subject:to:cc:date:reply-to:user-agent: $2
mflag -S $2
exit 0
;;
-vx)
mshow -B -x $2
exit 0
;;
-w)
shift
mcom $@
exit 0
;;
esac
unset MBLAZE
unset MBLAZE_NOCOLOR