I know it's not the exact answer you were looking for, but
your typical sendmail logfile contains all the info you're
asking for, without tweaking. It would be much easier to
write a quick script to parse the logfile instead of
writing a server. I've seen a few scripts floating around,
a few of them are registered on perl.com