Specifications

Setting Up the Database
The database for Warm Mail is fairly simple because we arent 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:
usernameTheir preferred username for Warm Mail
passwordTheir preferred password for Warm Mail
addressTheir preferred email address, which will appear in the From field of emails
they send from the system
displaynameThe human-readablename 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:
usernameThe Warm Mail user who this account belongs to.
serverThe machine on which the account resides, for example, localhost or
mail.tangledweb.com.au.
portThe port to connect to when using this account. Usually this will be 110 for POP3
servers and 143 for IMAP servers.
typeThe protocol used to connect to this server, either ‘POP3’ or ‘IMAP’.
remoteuserThe username for connecting to the mail server.
remotepasswordThe password for connecting to the mail server.
accountidA 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.sqlSQL 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