First of all, what are you using for your mail system? I've done this running Qmail / Vpopmail......it's fairly simple.
I simply have a .qmail file call a script everytime mail is received, it parses out whatever i want from the mail/mail headers, stores it in a DB and voila!
--
Keith Bussey
kbussey@wisol.com
Programmer - WISOL.com
(514) 398-9994 ext. 225