WebMail 2006 Implementation Notes - IceWarp Ltd. 


PHP:

Server engine runs on php4/5

Required extensions are:

imap
sqlite
smtp
mime parsing

When working with arrays only associative arrays will be used. No index looping is allowed. Beware of CPU usage and slowdowns.
For basic session security the php session system is used. The least information should be kept here (sessid and other few information).
Do not store the folder, account or items information here.


IMAP & SMTP:

Server communicates with IMAP and SMTP mailing protocols only.
For delivery the smtp extension with authentication is used.

For messages browsing IMAP is used. Each folder and its content is cached in sqlite db including:

account,folder,uid,size,time,subject,date,to,from,flags,cachefile

The last uid is remembered. For new mail checking An IMAP connection is established,
all messages list is fetched FETCH 1:* UID FLAGS - to know what messages have been deleted. Deleted messages are deleted from the DB and files storage.
New messages: FETCH lastuid+1:* UID FLAGS ENVELOPE INTERNALDATE RFC822[HEADER.FIELDS (From To Subject)]
Data is stored in local DB and processed.
When needed the whole message will be received from IMAP and stored in local file cache (db updated). Cached files can be deleted after some time.

Every IMAP mailbox/folder has a SUBSCRIBED flag - a flag whether to display the folder
LIST "" * (list all folders)
LSUB "" * (list subscribed folders)
These should be used

The complete folder list should be kept locally in cache. Folder list consists of subscribed IMAP folders and GW folders.

Possible storage:

sqlite - IMAP cached messages
user/account/folders.xml (cached folder list), user/account/cache/folder/<uid>.imap (cached file), user/account/imap.xml (lastuid and others)

A special mode not to cache IMAP messages locally should be possible - global option.

Messages and lists are downloaded only when user selected to download new messages.


GroupWare:

For GW the gw.php general API class is used.
Currently there is no folders method in the API so use static folder names (Contacts,Calendar,Tasks,Notes,Journal). Upcoming version of the API
will have getfolderslist(), addfolder(), deletefolder() methods.

Items can be either cached locally or every request to list items in a mailbox can be sent to the API. The implementation
should consider both.


Merak:

For Merak integration the Merak API classes are used. Special care must be taken with security - API can be used by anybody so validate 
it is really the WM user. 

User authentication is done via API. Authentication modes are plain and SASL. Plain passwords should be stored in the users XML file encoded
(they will be needed for the GW and IMAP access). Eventually the API will be queried for the user's password.
User's and global settings will be read from the API only once after logon.



Settings:

Settings are kept in XML files. There is 1 XML file for the global settings. An option to have more global settings per virtual host
will be possible in the future.

User settings are kept in multiple XML files.

No global list of users is ever created nor passwords will be freely available. Session password could be kept in the php session array.
