diff options
-rw-r--r-- | GNUmakefile | 1 | ||||
-rw-r--r-- | man/mcom.1 | 15 | ||||
-rwxr-xr-x | mcom | 30 |
3 files changed, 45 insertions, 1 deletions
diff --git a/GNUmakefile b/GNUmakefile index 3389143..61e8dfb 100644 --- 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 index 6e2ce0e..1bee90a 100644 --- 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 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" </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 |