add mbnc to bounce messages

pull/82/head
Leah Neukirchen 6 years ago
parent a6243d7a2f
commit 88a87a361a

@ -60,6 +60,7 @@ install: FRC all
install -m0755 $(ALL) $(SCRIPT) $(DESTDIR)$(BINDIR) install -m0755 $(ALL) $(SCRIPT) $(DESTDIR)$(BINDIR)
ln -sf mless $(DESTDIR)$(BINDIR)/mnext ln -sf mless $(DESTDIR)$(BINDIR)/mnext
ln -sf mless $(DESTDIR)$(BINDIR)/mprev ln -sf mless $(DESTDIR)$(BINDIR)/mprev
ln -sf mcom $(DESTDIR)$(BINDIR)/mbnc
ln -sf mcom $(DESTDIR)$(BINDIR)/mfwd ln -sf mcom $(DESTDIR)$(BINDIR)/mfwd
ln -sf mcom $(DESTDIR)$(BINDIR)/mrep ln -sf mcom $(DESTDIR)$(BINDIR)/mrep
install -m0644 man/*.1 $(DESTDIR)$(MANDIR)/man1 install -m0644 man/*.1 $(DESTDIR)$(MANDIR)/man1

@ -13,6 +13,7 @@ DESCRIPTION
mblaze consists of these Unix tools that each do one job: mblaze consists of these Unix tools that each do one job:
maddr(1) extract addresses from mail maddr(1) extract addresses from mail
magrep(1) find mails matching a pattern magrep(1) find mails matching a pattern
mbnc(1) bounces mail
mcom(1) compose and send mail mcom(1) compose and send mail
mdeliver(1) deliver messages or import mailboxes mdeliver(1) deliver messages or import mailboxes
mdirs(1) find Maildir folders mdirs(1) find Maildir folders
@ -126,6 +127,6 @@ LICENSE
To the extent possible under law, the creator of this work has waived all To the extent possible under law, the creator of this work has waived all
copyright and related or neighboring rights to this work. copyright and related or neighboring rights to this work.
http://creativecommons.org/publicdomain/zero/1.0/ http://creativecommons.org/publicdomain/zero/1.0/
Void Linux June 30, 2017 Void Linux Void Linux January 6, 2018 Void Linux

@ -1,4 +1,4 @@
.Dd June 30, 2017 .Dd January 6, 2018
.Dt MBLAZE 7 .Dt MBLAZE 7
.Os .Os
.Sh NAME .Sh NAME
@ -20,6 +20,8 @@ consists of these Unix tools that each do one job:
extract addresses from mail extract addresses from mail
.It Xr magrep 1 .It Xr magrep 1
find mails matching a pattern find mails matching a pattern
.It Xr mbnc 1
bounces mail
.It Xr mcom 1 .It Xr mcom 1
compose and send mail compose and send mail
.It Xr mdeliver 1 .It Xr mdeliver 1

@ -0,0 +1 @@
.so man1/mcom.1

@ -1,11 +1,12 @@
.Dd July 22, 2016 .Dd January 6, 2017
.Dt MCOM 1 .Dt MCOM 1
.Os .Os
.Sh NAME .Sh NAME
.Nm mcom , .Nm mcom ,
.Nm mfwd , .Nm mfwd ,
.Nm mbnc ,
.Nm mrep .Nm mrep
.Nd compose, forward, reply to, and send mail .Nd compose, forward, bounce, reply to, and send mail
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm mcom .Nm mcom
.Op Ar recipients\ ... .Op Ar recipients\ ...
@ -14,6 +15,8 @@
.Nm mfwd .Nm mfwd
.Op Fl r .Op Fl r
.Op Ar msgs\ ... .Op Ar msgs\ ...
.Nm mbnc
.Ar msg
.Nm mrep .Nm mrep
.Ar msg .Ar msg
.Sh DESCRIPTION .Sh DESCRIPTION
@ -40,6 +43,15 @@ to forward as
.Xr mshow 1 .Xr mshow 1
rendered plain text, using RFC934 message encapsulation. rendered plain text, using RFC934 message encapsulation.
.Pp .Pp
.Nm mbnc
behaves like
.Nm mcom
but creates the draft from the original
.Ar msg
(including headers)
and adds a Resent-To header, to which the message will
be bounced directly.
.Pp
.Nm mrep .Nm mrep
behaves like behaves like
.Nm mcom .Nm mcom

@ -0,0 +1 @@
mcom

38
mcom

@ -143,6 +143,14 @@ fi
done done
) fi ) fi
;; ;;
*mbnc*)
printf '%s: \n' Resent-To
from=$(mhdr -h local-mailbox "$MBLAZE/profile")
[ "$from" ] && printf 'Resent-From: %s\n' "$from"
msgid | sed 's/^/Resent-/'
printf 'Resent-Date: %s\n' "$(mdate)"
mseq "${@:-.}" | xargs -d'\n' cat
;;
*mrep*) *mrep*)
[ "$#" -eq 0 ] && set -- . [ "$#" -eq 0 ] && set -- .
ng=$(mhdr -h newsgroups "$1") ng=$(mhdr -h newsgroups "$1")
@ -178,16 +186,20 @@ fi
;; ;;
esac esac
if [ -f "$MBLAZE/signature" ]; then case "$0" in
SIGNATURE="$MBLAZE/signature" *mbnc*) ;;
elif [ -f ~/.signature ]; then *)
SIGNATURE="$HOME/.signature" if [ -f "$MBLAZE/signature" ]; then
fi SIGNATURE="$MBLAZE/signature"
elif [ -f ~/.signature ]; then
SIGNATURE="$HOME/.signature"
fi
if [ -n "$SIGNATURE" ]; then if [ -n "$SIGNATURE" ]; then
printf '%s\n' '-- ' printf '%s\n' '-- '
cat "$SIGNATURE" cat "$SIGNATURE"
fi fi
esac
} >$draft } >$draft
automime= automime=
@ -200,6 +212,14 @@ while :; do
*.*) sendmail="mblow";; *.*) sendmail="mblow";;
esac esac
resent="$(maddr -h resent-to "$draft")"
case "$resent" in
?*)
sendmail=$(mhdr -h sendmail "$MBLAZE/profile")
sendmail="${sendmail:-sendmail} -- $resent"
;;
esac
if [ -e $draftmime ]; then if [ -e $draftmime ]; then
if [ $draft -ot $draftmime ] || [ "$automime" -eq 1 ]; then if [ $draft -ot $draftmime ] || [ "$automime" -eq 1 ]; then
stampdate $draftmime stampdate $draftmime

Loading…
Cancel
Save