doc.txt

Mail Parse Library

_Mail Parse_ Library
====================

Parse an email, or a stream of emails, into simple structures.

Data
====

An Email is a
> (make-email (listof (cons Symbol String)) (listof (listof String)))
> (define-struct email (headers messages))

Headers are an associative list of all the headers from the email, minus the
MIME headers.

Messages is a list of all the messages/attachments in the email. For normal
emails without attachments, this is a list of one element.

A message is a list of strings, each string representing one line from the
email.

Exceptions
==========

> exn:malformed-email

Raised when the email stream is overly confusing, e.g. missing "From " between
messages.

Functions
=========

> parse-emails : [Input-port] -> (listof Email)

Use either the provided input port or _current-input-port_ as the stream of
emails. Parse each email using _parse-email_ and produce a list of all the
parsed emails.

> parse-email : [Input-port] -> Email

Use either the provided input port or _current-input-port_ as the stream of
a single email. Behaviour is undefined for a stream of multiple emails. Parse
the email into a structure, as defined above.