In this chapter, we looked at additional protocols needed to retrieve e-mail from the server: POP and IMAP. We learned that IMAP offers a number of advantages over POP:
IMAP messages can be accessed anytime, anywhere
IMAP message can be organized into an arbitrary number of mailboxes under common themes
IMAP messages can be downloaded in part or in their entirety
IMAP messages can be flagged for easy management
We have seen enough of PHP IMAP-related functions to understand and write sophisticated e-mail and news applications POP/IMAP or NNTP. We demonstrated how easily you could work with a POP/IMAP or NNTP server following these three simple steps:
Open a connection to the server and obtain a stream to a mailbox or newsgroup
Work with e-mail messages or news articles talking to the server through the stream
When done with the server, close the stream and free resources associated with it
While taking you through the list of essential IMAP functions, we built a general purpose web-based e-mail class on which you can build sophisticated e-mail and news applications. We wrapped up our discussion on e-mail and news with a complete web-based e-mail system built upon the e-mail classes created earlier.