Enhancing your Webmail program

In my first tutorial I created a simple Webmail application that uses the IMAP protocol to access a user's mailbox. In somewhere around 300 lines of code we were able to implement most of what you need to access an IMAP server to read, send, and delete email.

You might have asked yourself what on earth you would want to do with such an application when there are perfectly adequate mail programs around, and indeed, a handful of people did e-mail me to ask that very question.

Apart from the clear practicality as an example in an educational context, a Webmail application can be very useful in Real Life as well. For example, it might be a good alternative way of accessing your e-mail while on the road: you just need to pop into some Internet café, and all you need is a browser to access your mail.

NOTE: See page 6 for the code you'll need, and page 7 for the index page code.

More features!

The first version of the Webmail interface had a glaring omission: support for mail folders. Only people who hardly get any mail at all or who delete all their mail after they've read it would not be interested in having the option of moving messages to other folders.

First off, we've added another page that shows the user the mail a_folders she has created. This page is displayed when the user clicks the "folders" button that appears at the bottom left group of buttons whenever the user is viewing the contents of a folder.