Python's builtin mailbox parser can do this more efficiently, I think

Seb, I'm not sure if you had a reason for using regular expressions rather than just the built-in parse mailbox from file, but I suspect this is a more efficient method.