There is enough work in writing an email reader to occupy a whole book. I suggest you download an open source project that reads email. Install the code, use the code, and learn what you want to do with email. Later you can develop your own code or contribute to one of the open source projects.
Once you have used one of the email products, you can tackle building your own email client using the open source IMAP and POP3 classes used in Open Source software. Some products use their own classes and others use existing classes available for separate download. PHP classes are described in Chapter 17 Objects.
When I started writing the PHP Black Book, none of the PHP based open source mail projects had anywhere near the level of function I wanted so I did not list them in the book. Some of the projects have rapidly gained new features and appear to be well supported. I contribute ideas and code examples to them, rather than writing my own email client. I believe in the area of email, it is quicker to refine an existing application than to write your own.
IMAP or POP3?
POP3 is the most common access but limited when you want to keep the email on the server. IMAP gives you a standard way to manage email on a server but not all ISPs let you use IMAP with hosted sites. Some email clients depend on IMAP while others work with POP3. I have hosted sites that have a server based browser and POP3 access so I can collect my email on my machine. When travelling, I can pop in to an Internet CafÃ© and check for new mail. Back at my office, I download everything through POP3 then work locally.
Server or Workstation
Do you want the email left on the server or moved to your your workstation? Server based email can be accessed from anywhere but requires you to remain online. Workstation based email lets you go offline but you cannot then access your email from an Internet cafÃ© in Berlin or wherever you travel next.
POP3 mail is normally downloaded to your workstation. You can set up a POP3 client to leave email on the server while you travel and access the email from Internet cafÃ©s. The email can then be download when you reach home. The problem is accessing the email on your home workstation when travelling. A notebook computer is one solution.
You could download email from an IMAP server to a local IMAP file on your workstation but then you have a problem accessing the workstation based IMAP from other locations. If your Web server is on a local server, then you can access the IMAP or POP3 mail server locally through a firewall and not have to move mail to your workstation.
Groupware gives you more than email. The most common office applications, word processing, spreadsheets, and email are available in groupware products so people in a group can share documents and information. Calenders are the next most popular groupware applications as people can use the group calenders to organise meetings.
Groupware usually has an overall layer of software that manages your user id then a way of plugging in individual applications to perform specific tasks. If you manage several groups of people, you can add one application at a time to each group as each group is trained. You can also make sure documents belonging to one group are not visible to another group.
On server sites, I use PHPGroupWare from www.manvswebapp.com/phpgroupware. It has a lot more than email, is easy to install, and is easy to use. As a GNU project, it has to be PHP3 compatible and use a GPL licence. I prefer software written to use the full power of PHP4 but there are no GPL PHP4 groupware applications with anywhere near the range of PHPGroupWare.
Aeromail, www.nicolaas.net/aeromail/, is an example of email using SSL but not cookies or a database. Dion Nicolaas is updating the Aeromail program originally written by Mark Cushman.
Ciao EmailList Manager, www.technobreeze.net/php/emaillist, is a mass email application using an SQL database. You can use it for notification of updates to a Web site or a newsletter. Be sure your use is disclosed on your Web site and you are clear about privacy issues.
E*Reminders, sourceforge.net/projects/e-reminders, is an email based reminders system.
eZ publish, www.ez.no, is a content publishing system including mailouts. You have the choice of a GPL licence or a professional licence.
MyPhPim, sourceforge.net/projects/myphpim/, is a multiuser personal information manager including email, an addressbook, a notes system, a todo list, and calendar. it requires MySQL, PHP4, IMAP, mcrypt, and socket support.
Phorecast, phorecast.org, is, to quote their site, "a web-based single-user email, contact list, and calendar manager. It is an open-source project written in PHP. It uses a database backend to store messages and other information; this can be any one of a number of databases, depending on your preferences. MySQL, PostgreSQL, Microsoft SQL Server, and Oracle are all supported, among others." The main drawback is the single user aspect. A good starting point but a limitation when you want to let friends or co-workers use the site.
Pslash, www.pSlash.com, is a Web portal system including email redirecting. I have not used it and am interested in hearing from those that do use it.
Relata, www.relata.org, is a set of open-source Customer Relationship Management (CRM) software tools including volume email to customers.
SquirrelMail, www.squirrelmail.org, is recommended by many people. I have not used it.
TWIG, www.informationgateway.org, works with PHP3 and PHP4, IMAP and POP3 email, newsgroups, has a contact management application, scheduling, notes, bookmarks, and a todo list. It is translated to several languages. The last time I tried their demo, it presented most menu text translated to non display characters, suggesting that the translation was incorrectly activating and that the translation was not fully implemented.
Vamp, www.virdi-software.com/vamp, is a POP3 client that stores mail on your local machine. Vamp stores the mail in MySQL so you do not need an IMAP server. I looked at Vamp for customers in the country with high volumes of email but only a dial up connection.