You can write your own script that parses the mailboxes but I do not suggest that 'cause there are alternatives to access maildir.
What you need is a function with which you can download, browse modify the maildir, right?
http://www.php.net/manual/en/function.imap-open.php
Connection to the servern via POP3 or IMAP is a fairly easy thing to do. Everything you need is curl.