summaryrefslogtreecommitdiff
path: root/.local/bin/smail
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-08-26 13:34:51 +0300
committerThomas Voss <mail@thomasvoss.com> 2023-08-26 13:34:51 +0300
commite5079a986721eab1c8aa0e0a7e631cab113d4566 (patch)
tree7b392a95d99d21c37eef723b8f1214ec5d236e1d /.local/bin/smail
parent3a66aed7ed8db82e69bb4a359ebbe4ea716a81f6 (diff)
smail: Random script improvements
Diffstat (limited to '.local/bin/smail')
-rwxr-xr-x.local/bin/smail21
1 files 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