0

Is there any way to pass the postfix' queue id (not the Message-ID: header) to a procmail command?

The reason behind is to have a procmail logfile containing the queue id for detailed logging about a handled message.

Schubi Duah
  • 309
  • 1
  • 7
  • Good question. You might want to ask the [Postfix-users mailing list](http://www.postfix.org/lists.html). I am actually using several procmail recipes similar to what tripleee posted to distinguish local from remote mail. These provide the ID as a byproduct. – xebeche Dec 08 '18 at 16:19

1 Answers1

0

Procmail can extract anything you can articulate a regex for. Without access to your local headers, this is speculative and somewhat ad lib but hopefully it should at least give you an idea.

# Put a newline in a string for the log message
NL="
"
:0
* ^Received: from .* \
    by yourserver\.example\.com \(Postfix)\
    with [A-Z]+ id \/[A-F0-9]+
{ LOG="Postfix id $MATCH$NL" }

The special token \/ causes the matching text after it to be captured into the variable $MATCH.

tripleee
  • 175,061
  • 34
  • 275
  • 318