16.2. Architecture

AjaxMail is built using PHP for the server-side language and MySQL for the database. A database is necessary to keep track of information relating to specific messages, such as what folder they are in and whether they have been read. Both of these can be accomplished by setting specific flags for a message in the database.

There are two folders in AjaxMail: Inbox and Trash. When a message is deleted from the Inbox, it is moved to the Trash. The message is permanently deleted when the Trash is emptied; otherwise, the message remains in the Trash. (It is also possible to restore a message from the Trash and place it back in the Inbox.) Even though this chapter uses only these two folders, you may use as many folders as you wish.

Each time a request is made to the server, AjaxMail checks to see if there are any new messages in the specified POP3 e-mail account. If there are, the messages are downloaded and saved into the MySQL database. The messages are then read out of the database and sent back to the client.

16.2.1. Resources Used

AjaxMail uses several open source software libraries to achieve its functionality:

  • zXml Library: The cross-browser XML JavaScript library used throughout this book. Available at www.nczonline.net/downloads.

  • Douglas Crockford's JSON JavaScript Library: The JavaScript JSON parser. Available at www.json.org.

  • PHPMailer: A PHP SMTP e-mail sending solution. Available at http://phpmailer.sourceforge.net.

  • JSON-PHP: The PHP JSON library. Available ...

Get Professional Ajax, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.