Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: recommended storage format for email messages?

by hangon (Deacon)
on Jul 14, 2009 at 21:18 UTC ( #780078=note: print w/replies, xml ) Need Help??

in reply to recommended storage format for email messages?

A quick and dirty method I've used is to add a fixed length ascii field before each message. The field contains the message length in bytes. Then concat the messages with length field into a single file. To traverse, use read to get the message length, then read to grab the entire message or seek to the next one. The format is fairly trivial to code as long as your file will be used readonly. Note that it may not be portable to a different OS.

1148 Return-Path: <> Received: from To: Subject: file format Date: Tue, 14 Jul 2009 16:00:18 -0400 email message body bla bla bla etc ... etc ... etc ... 729 Return-Path: <> Received: ... Date: Tue, 14 Jul 2009 16:00:18 -0400 another email bla bla bla etc ...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://780078]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2018-04-21 21:53 GMT
Find Nodes?
    Voting Booth?