mblaze

Unix utilities to deal with Maildir - my mirror
git clone https://pi.duncano.de/git/mblaze.git
Log | Files | Refs | README | COPYING

commit 2939be9f34b400fa59cb12c59c2c101c852fea92
parent 01ad9ec927a6ec1b4acbce2a7e3b48135fa794e4
Author: Leah Neukirchen <leah@vuxu.org>
Date:   Sun, 18 Jun 2017 17:48:24 +0200

mcom: add mfwd command to forward messages

Diffstat:
GNUmakefile | 1+
man/mcom.1 | 15++++++++++++++-
mcom | 30++++++++++++++++++++++++++++++
3 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/GNUmakefile b/GNUmakefile @@ -56,6 +56,7 @@ install: FRC all install -m0755 $(ALL) $(SCRIPT) $(DESTDIR)$(BINDIR) ln -sf mless $(DESTDIR)$(BINDIR)/mnext ln -sf mless $(DESTDIR)$(BINDIR)/mprev + ln -sf mcom $(DESTDIR)$(BINDIR)/mfwd ln -sf mcom $(DESTDIR)$(BINDIR)/mrep install -m0644 man/*.1 $(DESTDIR)$(MANDIR)/man1 install -m0644 man/*.5 $(DESTDIR)$(MANDIR)/man5 diff --git a/man/mcom.1 b/man/mcom.1 @@ -3,11 +3,15 @@ .Os .Sh NAME .Nm mcom , +.Nm mfwd , .Nm mrep -.Nd compose new, reply to, and send mail +.Nd compose new, forward, reply to, and send mail .Sh SYNOPSIS .Nm mcom .Op Ar recipient +.Nm mfwd +.Op Fl r +.Op Ar msgs\ ... .Nm mrep .Ar msg .Sh DESCRIPTION @@ -16,6 +20,15 @@ creates a new draft mail and runs an editor. After editing, a loop is started where the user can re-edit, send or cancel the mail. .Pp +.Nm mfwd +behaves like +.Nm mcom +but fills the draft with subject and body prefilled to forward the messages. +By default, messages are forwarded verbatim as MIME attachments. +Use +.Fl r +to forward as rendered plain text, using RFC934 message encapsulation. +.Pp .Nm mrep behaves like .Nm mcom diff --git 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" </dev/null | + sed 's/^-/- &/' # RFC934 + printf '\n%s %s %s\n\n' \ + $SEP 'End forwarded message' $SEP + done + ) fi + ;; *mrep*) [ "$#" -eq 0 ] && set -- . ng=$(mhdr -h newsgroups "$1") @@ -100,6 +129,7 @@ fi mquote "$1" printf '\n' + ;; esac if [ -f "$MBLAZE/signature" ]; then