Hello,
looking in the archive there are multiple question like "howto access
the queueid from pipe service"
(http://marc.info/?l=postfix-users&s=pipe+queueid)
I had the same problem some times ago and wrote a patch.
Now I have the possibility to use the pipe command in master.cf like
described in
http://www.postfix.org/FILTER_README.html#simple_filter
filter unix - n n - 10 pipe
flags=Rq user=filter null_sender=
argv=/path/to/script -q ${queue_id} -f ${sender} -- ${recipient}
inside /path/to/script I could access the queueid (for logging
purposes) like other daemon usually do also.
That make the logging more precise when messages are delivered to a filter.
Maybe the patch could included in future versions of postfix.
Andreas
Index: postfix-2.11-20131103/src/pipe/pipe.c
===================================================================
--- postfix-2.11-20131103.orig/src/pipe/pipe.c 2013-04-05 23:27:48.000000000 +0200
+++ postfix-2.11-20131103/src/pipe/pipe.c 2013-11-03 17:55:10.000000000 +0100
@@ -259,6 +259,8 @@
/* and case folding.
/* .sp
/* This feature is available as of Postfix 2.5.
+/* .IP \fB${\fqueue_id\fR}\fR
+/* This macro expands to the queue id.
/* .IP \fB${\fBrecipient\fR}\fR
/* This macro expands to the complete recipient address.
/* .sp
@@ -501,6 +503,7 @@
#define PIPE_DICT_SASL_METHOD "sasl_method" /* key */
#define PIPE_DICT_SASL_USERNAME "sasl_username" /* key */
#define PIPE_DICT_SASL_SENDER "sasl_sender" /* key */
+#define PIPE_DICT_QUEUE_ID "queue_id" /* key */
/*
* Flags used to pass back the type of special parameter found by
@@ -600,6 +603,7 @@
PIPE_DICT_SASL_METHOD, 0,
PIPE_DICT_SASL_USERNAME, 0,
PIPE_DICT_SASL_SENDER, 0,
+ PIPE_DICT_QUEUE_ID, 0,
0, 0,
};
struct cmd_flags *p;
@@ -1220,6 +1224,8 @@
request->sasl_username);
dict_update(PIPE_DICT_TABLE, PIPE_DICT_SASL_SENDER,
request->sasl_sender);
+ dict_update(PIPE_DICT_TABLE, PIPE_DICT_QUEUE_ID,
+ request->queue_id);
vstring_free(buf);
if ((expanded_argv = expand_argv(service, attr.command,
Index: postfix-2.11-20131103/html/pipe.8.html
===================================================================
--- postfix-2.11-20131103.orig/html/pipe.8.html 2013-04-05 23:46:59.000000000 +0200
+++ postfix-2.11-20131103/html/pipe.8.html 2013-11-03 17:55:10.000000000 +0100
@@ -311,6 +311,9 @@
This feature is available as of Postfix 2.5.
+ <b>${queue_id</b>}
+ This macro expands to the queue id.
+
<b>${recipient</b>}
This macro expands to the complete recipient
address.
Index: postfix-2.11-20131103/man/man8/pipe.8
===================================================================
--- postfix-2.11-20131103.orig/man/man8/pipe.8 2013-04-05 23:27:48.000000000 +0200
+++ postfix-2.11-20131103/man/man8/pipe.8 2013-11-03 17:55:10.000000000 +0100
@@ -269,6 +269,8 @@
and case folding.
.sp
This feature is available as of Postfix 2.5.
+.IP \fB${\fBqueue_id\fR}\fR
+This macro expands to the queue id.
.IP \fB${\fBrecipient\fR}\fR
This macro expands to the complete recipient address.
.sp