]> git.madduck.net Git - etc/neomutt.git/blob - .config/neomutt/sendmail-checks.d/no-local-recipients

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

confvars update to latest version
[etc/neomutt.git] / .config / neomutt / sendmail-checks.d / no-local-recipients
1 #!/bin/sh
2 #
3 # no-local-recipients – prevent messages to local recipients from being sent
4 #
5 # messages with recipients like foo@$HOSTNAME are an indication that mutt has
6 # not expanded the aliases and thus appended $hostname (cf. $use_domain). In
7 # my use-case, that's a reason not to send a message.
8 #
9 # Copyright © 2010 martin f. krafft <madduck@madduck.net>
10 # Released under the terms of the Artistic Licence 2.0
11 #
12 set -eu
13
14 shift # $1 is the tmpfile, we don't need that
15
16 HOSTNAME=$(hostname --fqdn)
17
18 ret=0
19 for r in $@; do
20   case "$r" in
21     (*@${HOSTNAME}*)
22       echo >&2 "E: $r seems to be a local recipient, hence I won't send."
23       ret=1
24       ;;
25   esac
26 done
27
28 exit $ret