Queue files are part of the Postfix internal API. Non-Postfix
programs that depend on internal details are NOT SUPPORTED and WILL
CAUSE LOST MAIL.
That saud, there are ways to do this that don't require unsupported
usage.
Hubro:
> I want to write some tools for searching and filtering by the meta data of a
> large number (hundreds of thousands) of emails under
> /var/spool/postfix/deferred. Among other things, I want to find all queue
> IDs of mails sent from specific IP adresses so that they can be deleted.
That information is already available from the Postfix maillog file.
$ grep client= /var/log/maillog
May 28 01:22:27 spike postfix/smtpd[74407]: 3wb7Xz3wSczJrP0:
client=molamola.ripe.net[2001:67c:2e8:11::c100:1371]
This shows the queue ID and client name[ip address]. Once you extract
the queue IDs of interest you can pipe the result into the postsuper
command:
grep client= /var/log/maillog | extract queue IDs | postsuper -d -
If you don't have a mailllog, you could use the postqueue command
to list queue file metadata as JSON objects:
postqueue -j | extract queue IDs | postsuper -d -
In this case you are welcome to provide a patch to that adds the
remote SMTP client attributes to the JSON output.
Another possibility: submit a patch for the postcat command to read
queue IDs from stdin, and produce output that is easier to filter.
Wietse