You have a couple of options. As the orginal poster said - probably the simplest way is to set up an entry in the aliases file to a script.
Then the body of the email gets passed as standard input to the script. You can then use a perl script + Mime modules to parse out the bits of the message and do whatever you want with it.
One might also look at apache james - which is a custom mail server. They have the equivilent of servlets, called 'maillets' that you put your business logic in. They often hard to deploy in enterprise scenario's though as most companies don't like having custom mailservers being deployed.
... the aliases route is probably your best bet. one other note of caution - email isn't gauranteed. if you are using this as some sort of app to app messaging system, and you control both ends, you should probably look at something else, like JMS type messaging.
-Ace