NOCC is a simple and fast Webmail client which can handle POP3 and IMAP mailboxes and sends email via SMTP. It is written with PHP, has low requirements (no database, frames). Features multi-language support, MIME attachments, displays HTML messages.
The installation guide comes with the source code:
https://sourceforge.net/p/nocc/code/HEAD/tree/trunk/webmail/docs/INSTALL
If you encounter problems or bugs you can always try the current HEAD...