]> git.madduck.net Git - etc/mutt.git/blob - .mutt/sendmail

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:

add calendarserver list
[etc/mutt.git] / .mutt / sendmail
1 #!/bin/sh
2 #
3 # mutt/sendmail – sendmail wrapper to enforce some checks on outgoing mails
4 #
5 # The script basically just creates a temporary file and then invokes any
6 # executable scripts in ~/.mutt/sendmail-checks.d in run-parts style. They
7 # receive the filename of a temporary file holding the message to be sent as
8 # $1, followed by all recipients as determined by mutt.
9 #
10 # Copyright © 2010 martin f. krafft <madduck@madduck.net>
11 # Released under the terms of the Artistic Licence 2.0
12 #
13 set -eu
14
15 CHECKSDIR="$HOME/.mutt/sendmail-checks.d"
16 SENDMAIL="/usr/sbin/sendmail -oem -oi"
17
18 TMPFILE=$(tempfile -p mutt-sendmail -s .msg)
19 settrap () { trap "$@" 0 1 2 3 4 5 6 7 8 10 11 12 13 14 15; }
20 cleanup () { rm -f "$TMPFILE"; settrap -; }
21 settrap cleanup
22
23 cat > $TMPFILE
24 args=$(for a in $@; do case "$a" in (*@*) echo "--arg=$a";; esac; done)
25 run-parts --umask=0077 --arg="$TMPFILE" $args -- "$CHECKSDIR"
26 [ "$1" = -- ] && shift
27 $SENDMAIL "$@" < "$TMPFILE"
28
29 cleanup