SquirrelMail is a very nice open source, PHP-based webmail client. While I can't point you in the direction of a tutorial unfortunately, perhaps checking out their code will give you some ideas? http://sourceforge.net/projects/squirrelmail/
Second kudos for SquirrelMail. It was easy for me to setup. Had to tweek my services on the linux box a bit to accept imap connectivity, but it works for me. Web interface has a lot of customizations too, such as colors and how often it should check the email box. Was impressed.
Accessing and sending commands to a pop account was one of the most difficult things I have done in PHP. There is an object out there that I found that did most of the hard work for me, but even using that object got hairy at times.