It wouldn’t be too tough to write in PHP, have a look at Stack Overflow for a solution, but this is what I would do.
I would create an actual email address with a catch all alias associated to it. Then in MySQL I would create the email addresses that I want to receive mail to.
So I would have:
(you can name them whatever you want)
When someone sends email to any of these addresses, it would go to the email@example.com email address and sit in the inbox.
Next create a PHP script that can use POP to read emails and delete them from the server (I think PHP has built in functions for this). The script would check the send to address and look it up in your database. Then I could forward it to the right recipient (this is what Craigslist does), or it could be more elaborate and put the message in your database for an internal messaging system (sort of like LinkedIn or Facebook).
Not that tough to build at all.