Saturday, July 7, 2007

e-Mail structure and Mail Dir File format

The MAIL Dir Format
MAIL Directory format is a format followed to store emails as files.
The Mail Dir format has 3 directories

  • new
  • cur
  • tmp


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

Return-path:
Envelope-to:
Delivery-date:
Received:
Message-ID:
Date:
From:
To:
Subject:
In-Reply-To:
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_21969_10709103.1184337589825"
References:


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.

0 comments: