You might be able to reduce this code a bit by using Mail::Folder::Mbox.
In reply to Re: parsembox by ehdonhon in thread parsembox by vxp