Been writing an email archiving application for the office here. It stores every message in a MySQL table as follows :

| Field      | Type         | Null | Key | Default | Extra          |
-----
| message_id | int(10)      |      | PRI | NULL    | auto_increment |
| whofrom    | varchar(80)  | YES  |     | NULL    |                |
| subject    | varchar(255) | YES  |     | NULL    |                |
| date       | datetime     | YES  |     | NULL    |                |
| source     | longblob     | YES  |     | NULL    |                |
| msgid      | varchar(255) | YES  |     | NULL    |                |

The “source” field is the message source compressed with Compress::Zlib. Everything is going well, but my main problem is parsing all the damn different types of messages, I’ve got it displaying almost 99% of the messages headers and body, but the hardest part is getting the attachments. I’m using MIME::Parser.. Basically the workflow is:

if ($part->mime_type eq 'text/plain') {
$body .= $bodyHandle->as_string;
}
else { push @attachments, $bodyHandle; }

So this will assume if it’s not ’text/plain’ then we’ll assume it’s an attachment. However, sometimes this doesn’t work.. I dunno, I’m just frustrated, I’m sure ill figure it out soon.. also needa figure out how to make parse the attachment and allow the user to view it.