Just to round this up for anyone reading, there are (simplistically speaking) two ways you can do this.
1) As first suggested, you can connect to the mail server using a PHP script and parse the information in the email to a database. This is good if you don't have any access to the server the email system is running on, for example, if you just have a standard pop box. You have to do some strict checking to make sure you are getting all the emails though, especially in an IMAP environment where you can't trust the unread/read status of emails.
2) The other option as suggested by dustsmoke is really quite simple, I've been down this route a couple of times. You setup a procmail receipe that triggers on each mail that arrives on the server. The receipe calls a script which inserts in to the DB. If you have access to procmail and PHP CLI mode this is extremely simple, the PHP is a doddle and the procmail receipe can be downloaded. This is script is very easy to expand in the future, if you need to start dealing with massive quantities of email, procmail is certainly your best option.
HTH
Andrew