[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11.9 rfc.822 - RFC822 message parsing

Module: rfc.822
Defines a set of functions that parses and constructs the "Internet Message Format", a text format used to exchange e-mails. The most recent specification can be found in RFC2822 (RFC2822). The format was originally defined in RFC 822, and people still call it "RFC822 format", hence I named this module. In the following document, I also refer to the format as "RFC822 format".

Say (use rfc.822) to use this module.

Function: rfc822-header->list iport &optional strict?
Reads RFC822 format message from an input port iport, until it reaches the end of the message header. The header fields are unfolded, and broken into a list of the following format:
 
((name body) ...)
Name ... are the field names, and body ... are the corresponding field body, both as strings. Field names are converted to lower-case characters. Field bodies are not modified, except the folded line is concatenated, CRLFs removed. The order of fields are preserved.

Function: rfc822-parse-date string
Takes RFC-822 type date string, and returns eight values:
 
year, month, day-of-month, hour, minutes, seconds, timezone, day-of-week.

Timezone is an offset from UT in minutes. Day-of-week is a day from sunday, and may be #f if that information is not available. If the string is not parsable, all the elements are #f.

Note: This function follows the new definition of date format in RFC2822, but may fail to recognize "obsolete" format, which allows arbitrary comments appear between words.



This document was generated by Ken Dickey on November, 28 2002 using texi2html