:0 * ^Message-Id:[ ]*\/[^ ]+ { MSGID="$MATCH" } :0 * MSGID ?? ^[ ]*$|^<>$ { :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 E { LOG="get-msgid: lacking message-id, generating one...$NL" :0 fw |$FORMAIL -a Message-ID: } :0 * ^Message-Id:[ ]*\/[^ ]+ { MSGID="$MATCH" } } :0 * ! MSGID ?? ^<[^>]+>$ { LOG="get-msgid: message-id '$MSGID' not enclosed in <>, fixing it...$NL" MSGID="<$MSGID>" } :0 *$ MSGID ?? .+@$RE_MAILRELAYS> *$ !^Return-Path: .+@$RE_MAILRELAYS\> *$ !^Received: by $RE_MAILRELAYS \(postfix, from userid { 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" } }