Today I wanted to convert the contents of my postfix ‘deferred’ queue, which
was all spam stuck in my MTA, to mbox format so that I could feed it into
various spam-learning systems.
First I converted my Postfix queue to human-readable format with postcat:
This made a copy of each file in postcat format, but that’s only halfway there
– postcat has its own output format that isn’t anything like an mbox or a
maildir. Inspecting the output, and brushing up on my sed, I came up with this:
A final pass over all of the messages, and I had my mbox file to train SpamAssassin with: