summaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-08-26 03:08:21 +0300
committerThomas Voss <mail@thomasvoss.com> 2023-08-26 03:08:21 +0300
commit25ef7dd0cf27f4341161eb386d6388b4649a6100 (patch)
tree75330c8aeda846d0ce2632223b1f78ce0d3460b4 /.local
parent4402899c96e426d7302fd681ffde5d782fb6ab39 (diff)
smail: Add ‘smail’ for simple mail
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/smail20
1 files changed, 20 insertions, 0 deletions
diff --git a/.local/bin/smail b/.local/bin/smail
new file mode 100755
index 0000000..a51476a
--- /dev/null
+++ b/.local/bin/smail
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+set -e
+
+tmp=`mktemp`
+trap "rm -f $tmp" EXIT
+
+cat - >$tmp
+addr="`mhdr -h from $tmp | 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
+ }