I would personally recommend perl webmail. It's a fairly straightforward perl CGI script which I've used in the past without problems. Handles POP3 and the code is quite clear. I don't know why it doesn't use strict though :-P