X-Git-Url: https://git.madduck.net/etc/neomutt.git/blobdiff_plain/a6ac44586209b9b0be5add1bef270451f3dcb677..4d1afcd5cc3e282554877a10d6be81931ef0cc03:/.config/neomutt/sendmail-checks.d/no-local-recipients diff --git a/.config/neomutt/sendmail-checks.d/no-local-recipients b/.config/neomutt/sendmail-checks.d/no-local-recipients new file mode 100755 index 0000000..fa8de41 --- /dev/null +++ b/.config/neomutt/sendmail-checks.d/no-local-recipients @@ -0,0 +1,28 @@ +#!/bin/sh +# +# no-local-recipients – prevent messages to local recipients from being sent +# +# messages with recipients like foo@$HOSTNAME are an indication that mutt has +# not expanded the aliases and thus appended $hostname (cf. $use_domain). In +# my use-case, that's a reason not to send a message. +# +# Copyright © 2010 martin f. krafft +# Released under the terms of the Artistic Licence 2.0 +# +set -eu + +shift # $1 is the tmpfile, we don't need that + +HOSTNAME=$(hostname --fqdn) + +ret=0 +for r in $@; do + case "$r" in + (*@${HOSTNAME}*) + echo >&2 "E: $r seems to be a local recipient, hence I won't send." + ret=1 + ;; + esac +done + +exit $ret