From e5079a986721eab1c8aa0e0a7e631cab113d4566 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 26 Aug 2023 13:34:51 +0300 Subject: smail: Random script improvements --- .local/bin/smail | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.local/bin/smail b/.local/bin/smail index a51476a..869beb8 100755 --- a/.local/bin/smail +++ b/.local/bin/smail @@ -5,16 +5,15 @@ set -e tmp=`mktemp` trap "rm -f $tmp" EXIT -cat - >$tmp -addr="`mhdr -h from $tmp | sed -E '/.*<.*>$/s/.*<(.*)>$/\1/'`" +addr="`tee $tmp | mhdr -h from - | sed -E '/.*<.*>$/s/.*<(.*)>$/\1/'`" mbox="$MAILDIR/$addr/Sent" -msmtp -t --read-envelope-from <$tmp \ - && { - mgenmid \ - | sed 's/^/Message-Id: /' \ - | cat - $tmp \ - | mmime \ - | mdeliver -cv "$mbox" \ - | xargs mflag -S >/dev/null - } +if msmtp -t --read-envelope-from <$tmp +then + mgenmid \ + | sed 's/^/Message-Id: /' \ + | cat - $tmp \ + | mmime \ + | mdeliver -cv "$mbox" \ + | xargs chronic mflag -S +fi -- cgit v1.2.3