X-Git-Url: https://git.madduck.net/etc/mailfilter.git/blobdiff_plain/5af333ca3b83425e5cb3aa704b37654d576856c1..9fcbb744b781eedf010a64837580afa0fcd8e2ae:/procmail/get-msgid diff --git a/procmail/get-msgid b/procmail/get-msgid index e859f2d..50fbef4 100644 --- a/procmail/get-msgid +++ b/procmail/get-msgid @@ -5,15 +5,24 @@ :0 * MSGID ?? ^[ ]*$|^<>$ { - TMPFILE="`tempfile -p msgid`" - LOG="get-msgid: LACKING MSGID header, DUMPING to $TMPFILE$NL" + :0 + * ^Resent-Message-Id:[ ]*\/[^ ]+ + { + LOG="get-msgid: lacking message-id, using resent-message-id...$NL" + :0 fw + |$FORMAIL -R Resent-Message-ID Message-ID + } - :0 ifw - |cat > $TMPFILE + :0 E + { + LOG="get-msgid: lacking message-id, generating one...$NL" + :0 fw + |$FORMAIL -a Message-ID: + } - EX_DEFER=75 - EXITCODE=$EX_DEFER - HOST + :0 + * ^Message-Id:[ ]*\/[^ ]+ + { MSGID="$MATCH" } } :0 @@ -27,13 +36,8 @@ *$ MSGID ?? .+@$RE_MAILRELAYS> *$ !^Return-Path: .+@$RE_MAILRELAYS\> *$ !^Received: by $RE_MAILRELAYS \(postfix, from userid +* MSGID ?? ^<\/[^>]+ { LOG="get-msgid: missing message ID added by one of our mail relays$NL" - - :0 fw - |$SED -re "s/^([Mm]essage-[Ii][Dd]:[^@]+@$RE_MAILRELAYS)\>/\1.MSGID-ADDED/" - - :0 - * ^Message-Id:[ ]*\/[^ ]+ - { MSGID="$MATCH" } + MSGID="<${MATCH}.MSGID-ADDED>" }