This is the main table, with one row per mail message, except for those that are trashed (which are in trashed_mail).
> Columns
mail_id: integer,primary key
The unique internal mail identifier.It is generated from the
seq_mail_id sequence. The value is unique across both mail and
trashed_mail tables.
sender: varchar(200)
The RFC822 address part extracted from the "From" address. If there
are several senders (quite uncommon, but not illegal), the names are
joined by a comma. The value is also arbitrarily truncated at the
size of the database field (200 characters)
toname: varchar(200)
The RFC822 address part extracted from the "To" address.
replyto: varchar(200)
The RFC822 address part extracted from the "ReplyTo" address.
cc: varchar(200)
The RFC822 address part extracted from the "Cc" address.
sender_fullname: varchar(200)
The RFC822 name part extracted from the "From" address. If there
are several senders (quite uncommon, but not illegal), the names are
joined by a comma. The value is also arbitrarily truncated at the
size of the database field (200 characters)
subject: varchar(1000)
The subject of the mail, decoded according to rfc2047 rules and
truncated to 1000 characters. The full subject is available in the
headers (see table header).
msg_date: timestamptz
The date and time at which the mail has been inserted into the
database. For incoming messages, it is different from the sender_date
(see below the definition of the sender_date field)
The timezone is also that of the manitou system, not the sender's.
sender_date: timestamptz
The date and time at which the mail has been sent by the originator.
It depends on the sender computer's date and time accuracy.
mbox_id: integer
When not null, that field references an entry in the
mailboxes table.
Incoming mails are assigned a mbox_id depending on the configuration
and options of manitou-mdx. For outgoing mails, the mbox_id field will be
set if the email of the identity issuing the message matches with
a mailbox name from the mailboxes table.
user_lock: integer
ID of the user that is currently holding a lock on the
message. This information is set is used by the user interface in
multi-user mode. Contains null if no lock has been set on the
message, or if it has been removed.
time_lock: date
Date and time at which the user lock has been set for the last time.
Null if no lock has never been set on the message.
attachments: integer
The number of attachments belonging to the message. This should
always be equal to SELECT count(*) FROM attachments WHERE mail_id=:id
It's precisely used to avoid this query for messages that have no
attachment.
status: integer
A mask of bits that contain cumulative information about the
message. The bits are:
Status | Bit number | Weight | Description |
---|---|---|---|
Read | 0 | 1 | The message has been read |
Unused | 1 | 2 | Reserved: do not use |
Replied | 2 | 4 | A reply to the message has been made |
Forwarded | 3 | 8 | The message has been forwarded |
Trashed | 4 | 16 | The message has been trashed |
Archived | 5 | 32 | The message has been processed and is archived |
Selected (lock) | 6 | 64 | The message is currently selected by a user for processing |
Outgoing | 7 | 128 | The message is scheduled for sending |
Sent | 8 | 256 | The message has been sent (if set, the Outgoing bit is always also set) |
Replying | 9 | 512 | The message is currently being replied to by a user |
Composed | 10 | 1024 | The message has been composed, but not yet scheduled for sending |
The bits are added together. For example, a message that has been read, then replied to and thus marked as archived should have its status set to 1+4+32=37. A status of zero indicates a new message. This information is in partly reflected in the mail_status table, for the values of status that are the most commonly queried upon. Updates of this table are done by a trigger that is fired by an update of status or an insert or delete on the table.
operator: integer
Internal unique ID of the person (foreign key into the users
table) that most recently processed the message
(replied,forwarded,trashed,archived, or composed for an
outgoing message)
thread_id: integer
Internal unique ID of the discussion thread if a thread is referenced
and recognized in the message (by looking at the Reply-To or References header
fields). Null if the message couldn't be assigned to a thread.
message_id: varchar(100)
The value of the Message-ID header field, truncated if necessary.
in_reply_to: integer
If the message is a reply to another message that also is in the mail table,
then that field is a pointer to that message, by its internal unique ID
(foreign key to a mail_id). Otherwise it's null.
msg_day: integer
This field holds the number of days between January 1st 1970 and
msg_date. Its purpose is to be used in queries that
search against a range of dates, when using the
msg_date field appear not to be efficient enough
due to performance reasons.
priority: integer
The priority of the message, as set by filter rules or by a user.
> Size
One row per non-trashed message.
> Additional notes
The structure of the mail table must be the same as trashed_mail. If one of them get extended with new columns, the other has to be kept in sync.