Specifications
Setting Up the Database
The database for Warm Mail is fairly simple because we aren’t actually going to store any of
the emails in it.
We will need to store users of the system. For each user, we will need to store the following fields:
• username—Their preferred username for Warm Mail
• password—Their preferred password for Warm Mail
•
address—Their preferred email address, which will appear in the From field of emails
they send from the system
• displayname—The “human-readable” name that they would like displayed in emails
from them to others
We will also need to store each account that users would like to check with the system. For
each account, we will need to store the following information:
• username—The Warm Mail user who this account belongs to.
• server—The machine on which the account resides, for example, localhost or
mail.tangledweb.com.au.
• port—The port to connect to when using this account. Usually this will be 110 for POP3
servers and 143 for IMAP servers.
• type—The protocol used to connect to this server, either ‘POP3’ or ‘IMAP’.
• remoteuser—The username for connecting to the mail server.
• remotepassword—The password for connecting to the mail server.
• accountid—A unique key for identifying accounts.
You can set up the database for this application by running the SQL shown in Listing 27.1.
LISTING 27.1 create_database.sql—SQL to Create the Mail Database
create database mail;
use mail;
create table users
(
username char(16) not null primary key,
password char(16) not null,
address char(100) not null,
displayname char(100) not null
);
Building Practical PHP and MySQL Projects
P
ART V
622
33 7842 CH27 3/6/01 3:41 PM Page 622










