]> git.madduck.net Git - etc/mailfilter.git/blob - procmail/get-msgid

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:

write X-Eq* headers at the end
[etc/mailfilter.git] / procmail / get-msgid
1 :0
2 * ^Message-Id:[         ]*\/[^  ]+
3 { MSGID="$MATCH" }
4
5 :0
6 * MSGID ?? ^[   ]*$|^<>$
7 {
8   TMPFILE="`tempfile -p msgid`"
9   LOG="get-msgid:   LACKING MSGID header, DUMPING to $TMPFILE (@$OURDATE)$NL"
10
11   :0 ifw
12   |cat > $TMPFILE
13
14   EX_DEFER=75
15   EXITCODE=$EX_DEFER
16   HOST
17 }
18
19 :0
20 * ! MSGID ?? ^<[^>]+>$
21 {
22   LOG="get-msgid:   message-id '$MSGID' not enclosed in <>, fixing it...$NL"
23   MSGID="<$MSGID>"
24 }
25
26 :0
27 *$ MSGID ?? .+@$RE_MAILRELAYS>
28 *$ !^Return-Path: .+@$RE_MAILRELAYS\>
29 *$ !^Received: by $RE_MAILRELAYS \(postfix, from userid
30 {
31   LOG="get-msgid:   missing message ID added by one of our mail relays$NL"
32
33   :0 fw
34   |$SED -re "s/^([Mm]essage-[Ii][Dd]:[^@]+@$RE_MAILRELAYS)\>/\1.MSGID-ADDED/"
35
36   :0
37   * ^Message-Id:[       ]*\/[^  ]+
38   { MSGID="$MATCH" }
39 }