summaryrefslogtreecommitdiff
path: root/.local/bin/smail
diff options
context:
space:
mode:
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