]> git.madduck.net Git - etc/mutt.git/commitdiff

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:

migrate check for local rcpts to sendmail checks
authormartin f. krafft <madduck@madduck.net>
Mon, 14 Jun 2010 10:02:20 +0000 (12:02 +0200)
committermartin f. krafft <madduck@madduck.net>
Mon, 14 Jun 2010 10:27:44 +0000 (12:27 +0200)
.mutt/hooks
.mutt/sendmail-checks.d/no-local-recipients [new file with mode: 0755]

index 4613eda1cd29c6f94cde247bf51acfaed05e676c..4c809eb6a8f0b784d5c279dd23270b735ff11ea5 100644 (file)
@@ -1,9 +1,6 @@
 save-hook . =store
 
 send2-hook '~C notyet' "set sendmail='~/.mutt/error 1 I will not send this draft yet!'"
-# this next works in combination with $use_domain to ensure I don't send
-# without expanding aliases:
-send2-hook '~C @$hostname' "set sendmail='~/.mutt/error 1 Check your recipients!'"
 
 send2-hook '~C @packages\.qa\.debian\.org' 'my_hdr X-PTS-Approved: please'
 
diff --git a/.mutt/sendmail-checks.d/no-local-recipients b/.mutt/sendmail-checks.d/no-local-recipients
new file mode 100755 (executable)
index 0000000..fa8de41
--- /dev/null
@@ -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 <madduck@madduck.net>
+# 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