Image

Imagesimbab wrote in Imagelinux 😡annoyed Ohio

Salvaging mail from screwed up server

I had a mail server that downloaded e-mail from GMail and our ISP POP accounts and made it accessible, after spam- and virus-scanning it, in a nice IMAP interface. It was nice while it lasted.

I was gone for several weeks here recently, and apparently the whole damn thing blew up--more specifically, as near as I can tell, the antivirus stopped working and this had a stopped-drain effect--there are now several hundred e-mails stuck in the Postfix queue.

I don't want to fix it, I am moving out of my parents' house in only a couple of months and more than likely I'll be taking the physical machine  with me--I will set them up with a basic wireless router, now that I won't be here to maintain this thing it's a disaster waiting to happen. What I want to do, however, is salvage the mail from the queue and get it into Mbox format so I can import it into another mail account (probably GMail, there's a import tool I found written in Python that accepts Maildirs and Mboxes, among other formats), one that is not maintained by me and if anyone has any issues they can harass someone else. :P

Does anyone know how to extract mail from a Postfix queue and get it into a manageable format for importing somewhere else? When I run 'postqueue -f' the /var/log/mail.log file is filled up with errors saying "mail transport unavailable". I honestly cannot remember the HOWTO I used to set this damn thing up so I am a bit clueless here.

I guess I have learned the hard way that mail servers aren't any fun. :P

Edit—Solution: Actually if you Google "postfix queue format" there are some mailing list postings here and there that detail that Postfix in fact has a rather specific queue format that is not designed to be accessed directly. That said, there is the postcat(1) tool that postfix provides (print queue files in human-readable format) and the pfqueue toolset provides an ncurses-style interface for managing queues for all manner of MTAs. Using that I whittled the queue down to about 20 messages, seeing as about 180 of the messages were spam (or mailer-daemon messages) anyways. :P The postcat utility isn't quite perfect for mbox imports, as it includes some additional Postfix-specific information before the actual message contents, but I think at this point I think 20 messages is manually manageable using text editors and such, whereas 200 messages most certainly was not.