The MAIL Dir Format
MAIL Directory format is a format followed to store emails as files.
The Mail Dir format has 3 directories
The new directory contains all the new mails, ie unread mails.
The cur directory contains all the read mails.
The tmp directory is a temporary directory used to store mails that are being received.
When a mail is read it is moved from new to cur.
All the emails are stored in files with a unique name (usually the message id).
The emails are stored as plain text in these files with the full headers and content.
The e-Mail Structure
Emails stored in the file with full headers and content.
The Email structure can be divided into
the head and body.
The head contains all the email related information
The body actually contains the contents it can be of many parts
HTML Part, Plain Text Part, Attachments , etc...
The various parts are divided by a boundary which is a unique string that appears nowhere else in the content.