diff --git a/GNUmakefile b/GNUmakefile index 79234a4..23f3964 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -60,6 +60,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)/mbnc ln -sf mcom $(DESTDIR)$(BINDIR)/mfwd ln -sf mcom $(DESTDIR)$(BINDIR)/mrep install -m0644 man/*.1 $(DESTDIR)$(MANDIR)/man1 diff --git a/README b/README index d228edb..792ffc7 100644 --- a/README +++ b/README @@ -13,6 +13,7 @@ DESCRIPTION mblaze consists of these Unix tools that each do one job: maddr(1) extract addresses from mail magrep(1) find mails matching a pattern + mbnc(1) bounces mail mcom(1) compose and send mail mdeliver(1) deliver messages or import mailboxes mdirs(1) find Maildir folders @@ -126,6 +127,6 @@ LICENSE To the extent possible under law, the creator of this work has waived all 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 diff --git a/man/mblaze.7 b/man/mblaze.7 index d843968..8b02263 100644 --- a/man/mblaze.7 +++ b/man/mblaze.7 @@ -1,4 +1,4 @@ -.Dd June 30, 2017 +.Dd January 6, 2018 .Dt MBLAZE 7 .Os .Sh NAME @@ -20,6 +20,8 @@ consists of these Unix tools that each do one job: extract addresses from mail .It Xr magrep 1 find mails matching a pattern +.It Xr mbnc 1 +bounces mail .It Xr mcom 1 compose and send mail .It Xr mdeliver 1 diff --git a/man/mbnc.1 b/man/mbnc.1 new file mode 100644 index 0000000..04eb765 --- /dev/null +++ b/man/mbnc.1 @@ -0,0 +1 @@ +.so man1/mcom.1 diff --git a/man/mcom.1 b/man/mcom.1 index b98ae1f..b9852ed 100644 --- a/man/mcom.1 +++ b/man/mcom.1 @@ -1,11 +1,12 @@ -.Dd July 22, 2016 +.Dd January 6, 2017 .Dt MCOM 1 .Os .Sh NAME .Nm mcom , .Nm mfwd , +.Nm mbnc , .Nm mrep -.Nd compose, forward, reply to, and send mail +.Nd compose, forward, bounce, reply to, and send mail .Sh SYNOPSIS .Nm mcom .Op Ar recipients\ ... @@ -14,6 +15,8 @@ .Nm mfwd .Op Fl r .Op Ar msgs\ ... +.Nm mbnc +.Ar msg .Nm mrep .Ar msg .Sh DESCRIPTION @@ -40,6 +43,15 @@ to forward as .Xr mshow 1 rendered plain text, using RFC934 message encapsulation. .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 behaves like .Nm mcom diff --git a/mbnc b/mbnc new file mode 120000 index 0000000..5574ca9 --- /dev/null +++ b/mbnc @@ -0,0 +1 @@ +mcom \ No newline at end of file diff --git a/mcom b/mcom index fb7ec8d..0603cee 100755 --- a/mcom +++ b/mcom @@ -143,6 +143,14 @@ fi done ) 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*) [ "$#" -eq 0 ] && set -- . ng=$(mhdr -h newsgroups "$1") @@ -178,16 +186,20 @@ fi ;; esac - if [ -f "$MBLAZE/signature" ]; then - SIGNATURE="$MBLAZE/signature" - elif [ -f ~/.signature ]; then - SIGNATURE="$HOME/.signature" - fi + case "$0" in + *mbnc*) ;; + *) + if [ -f "$MBLAZE/signature" ]; then + SIGNATURE="$MBLAZE/signature" + elif [ -f ~/.signature ]; then + SIGNATURE="$HOME/.signature" + fi - if [ -n "$SIGNATURE" ]; then - printf '%s\n' '-- ' - cat "$SIGNATURE" - fi + if [ -n "$SIGNATURE" ]; then + printf '%s\n' '-- ' + cat "$SIGNATURE" + fi + esac } >$draft automime= @@ -200,6 +212,14 @@ while :; do *.*) sendmail="mblow";; 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 [ $draft -ot $draftmime ] || [ "$automime" -eq 1 ]; then stampdate $draftmime