This weekend I added preliminary support for JSON-formatted queue
listings. See below for a fragment from the postqueue manpage.
Now, a Postfix queue may contain millions of messages, and each
message may contain lots of recipients. A robust application would
not read the entire JSON queue listing into memory. Instead, it
would process the JSON queue listing one message object at a time
(this should be easy because the output is formatted as in RFC 7159,
including the two-space indent).
I need to clean up the code and add quoting for control characters
etc. before it can be released.
Wietse
-j Produce a queue listing in RFC 7159 JSON format, for processing
by other programs. The output is an array with zero or more
objects, each object representing one queue file. All object
members are strings unless indicated otherwise.
queue_name
The name of the queue where the message was found. Note
that the queue may change while a listing is created; it
is possible that the same message is listed more than
once, and it is possible that some message is missed.
queue_id
The queue file name. The name may be reused unless
"enable_long_queue_ids = true".
arrival_time
The number of seconds since the start of the UNIX epoch.
message_size
The number of bytes in the message header and body. This
number does not include message envelope information. It
is approximately equal to the number of bytes that would
be transmitted via SMTP including the <CR><LF> line end-
ings.
sender The envelope sender address.
recipients
An array with zero or more objects with members "address"
and "delay_reason" (default: empty).