Email Parsing Woes

Posted by Michael Palmer on Wednesday, May 5, 2004

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

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:

1
2
3
4
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.


comments powered by Disqus