From 2939be9f34b400fa59cb12c59c2c101c852fea92 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Sun, 18 Jun 2017 17:48:24 +0200 Subject: mcom: add mfwd command to forward messages --- mcom | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'mcom') diff --git a/mcom b/mcom index 07f25f8..9fea4c6 100755 --- a/mcom +++ b/mcom @@ -67,6 +67,35 @@ fi msgdate printf '\n\n' ;; + *mfwd*) + raw= + [ "$1" = -r ] && raw=1 && shift + [ "$#" -eq 0 ] && set -- . + printf '%s: \n' To Cc Bcc + mscan -f 'Subject: [%f] %s' "$@" | sed 1q + from=$(mhdr -h local-mailbox "$MBLAZE/profile") + [ "$from" ] && printf 'From: %s\n' "$from" + cat "$MBLAZE/headers" 2>/dev/null + msgid + museragent + msgdate + printf '\n\n' + if [ -n "$raw" ]; then + mseq -r "$@" | sed 's:^:#message/rfc822 :' + else ( + SEP=----- + IFS=' +' + for f in $(mseq -r "$@"); do + printf '%s Forwarded message from %s %s\n\n' \ + $SEP "$(mhdr -d -h from "$f")" $SEP + DISPLAY= mshow -n -N "$f"