Eric Carr wrote:

Could anyone share some insight on the format of mailboxes and single mails?
If i want to parse them myself, how do I know where the headers end and the
body begins?



iMail mail files are created in 'mbox' format. I think the relevant RFC is 822. But here's some 'short notes' that I took while creating a program to transfer mailboxes from our old server to iMail (it seems not everyone agrees on some of the fine details)


Messages always begin with a 'From ' line. This is a line that begins with 'capital-eff-arr-oh-em-space'. The message header and body are separated with a blank line. Any line in the header that begins with one or more spaces is considered a continuation of the previous line. The message ends when you get another 'From ' line, or you get to the end of the file. If, as luck would have it, a line of the body of the message would start with 'From ', the mail server is supposed to store it as ' From ' to avoid fragmentation. The message header 'From ' line is constructed like so:

From (fromemailaddr) (DOW) (month) (day) (time) (year)

From <[EMAIL PROTECTED]> Wed Aug 06 10:06:38 2003


The problem I ran into was that some servers store the time as hh:mm, others as hh:mm:ss; the difference caused e-mail clients to get invalid dates for the e-mail messages. Our old mail server also didn't add the space to 'From ' lines in the message body, so I had to determine if the line had the other elements to decide if it really was a new message or not.


--
-------------------------------------------------------------------
illigitimi non carborundum
-------------------------------------------------------------------
Bud Durland, CNE                                 Mold-Rite Plastics
Network Administrator                         http://www.mrpcap.com
-------------------------------------------------------------------


--- [This E-mail scanned for viruses by Declude Virus / Sophos AV]


To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/ Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/

Reply via email to