mcom: add mfwd command to forward messages

pull/37/head
Leah Neukirchen 7 years ago
parent 01ad9ec927
commit 2939be9f34

@ -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

@ -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

30
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

Loading…
Cancel
Save