summaryrefslogtreecommitdiff
path: root/.local/bin/smail
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-12-06 20:58:18 +0100
committerThomas Voss <mail@thomasvoss.com> 2023-12-06 20:58:47 +0100
commitdb7321af115a79b63267cb18889cbd334e8ca6e2 (patch)
treeec388295051ebc1f3d79bd3baf79b7f12f076cda /.local/bin/smail
parentf2fde1570a04a654e2ed0c165d56feb29ddb25bf (diff)
scripts: Move many a script from sh to andy
Diffstat (limited to '.local/bin/smail')
-rwxr-xr-x.local/bin/smail29
1 files changed, 14 insertions, 15 deletions
diff --git a/.local/bin/smail b/.local/bin/smail
index fa1c887..7268307 100755
--- a/.local/bin/smail
+++ b/.local/bin/smail
@@ -1,20 +1,19 @@
-#!/bin/sh
+#!/usr/local/bin/andy
-set -e
-
-tmp=`mktemp`
-trap "rm -f $tmp" EXIT
+set tmp `mktemp
+func sigexit {
+ rm -f $tmp
+}
cat >$tmp
-addr="`mhdr -h from $tmp | sed -E '/.*<.*>$/s/.*<(.*)>$/\1/'`"
-mbox="$MAILDIR/$addr/Sent"
+set addr `mhdr -h from $tmp | sed -E '/.*<.*>$/s/.*<(.*)>$/\1/'
+set mbox $MAILDIR/$addr/Sent
-if msmtp -t --read-envelope-from <$tmp
-then
- mgenmid \
- | sed 's/^/Message-Id: /' \
- | cat - $tmp \
- | mmime \
- | mdeliver -cv "$mbox" \
+if msmtp -t --read-envelope-from <$tmp {
+ mgenmid
+ | sed 's/^/Message-Id: /'
+ | cat - $tmp
+ | mmime
+ | mdeliver -cv $mbox
| xargs chronic mflag -S
-fi
+}