Am not sure I understand your question especially the part of extracting email headers from an account (and not from an email message) ...
Anyways, FYI: messages are stored in /var/qmail/queue/ (within this folder you will find the bounce folder for the bounced messages and mess for the messages queued)