domain-auth-0.2.0: Domain authentication library

Network.DomainAuth.Mail

Contents

Description

A library to parse e-mail messages both from a file and Milter(https://www.milter.org/).

Synopsis

Documentation

Types for raw e-mail message

type RawMail = ByteStringSource

Type for raw e-mail message.

type RawFieldKey = ByteStringSource

Field key for raw e-mail message.

type RawFieldValue = ByteStringSource

Field value for raw e-mail message.

type RawBodyChunk = ByteStringSource

Body chunk for raw e-mail message.

Types for parsed e-mail message

data Mail Source

Type for parsed e-mail message.

Constructors

Mail 

Instances

type Header = [Field]Source

Header type for parsed e-mail message.

data Field Source

Field type for parsed e-mail message.

Instances

type CanonFieldKey = ByteStringSource

Type for canonicalized field key of parsed e-mail message.

type FieldKey = ByteStringSource

Type for field key of parsed e-mail message.

type FieldValue = [ByteString]Source

Type for field value of parsed e-mail message.

type Body = Seq ByteStringSource

Type for body of parsed e-mail message.

canonicalizeKey :: FieldKey -> CanonFieldKeySource

Canonicalizing FieldKey for search.

Obtaining Mail

readMail :: FilePath -> IO MailSource

Obtain Mail from a file.

Obtaining Mail incrementally.

data XMail Source

Type for temporary data to parse e-mail message.

Constructors

XMail 

Instances

initialXMail :: XMailSource

Initial value for XMail.

pushField :: RawFieldKey -> RawFieldValue -> XMail -> XMailSource

Storing field key and field value to the temporary data.

pushBody :: RawBodyChunk -> XMail -> XMailSource

Storing body chunk to the temporary data.

finalizeMail :: XMail -> MailSource

Converting XMail to Mail.

Functions to manipulate Header

fieldsFrom :: FieldKey -> Header -> HeaderSource

Obtaining the Field of FieldKey and all fields under FieldKey.

fieldsAfter :: FieldKey -> Header -> HeaderSource

Obtaining all fields under FieldKey.

fieldsWith :: [CanonFieldKey] -> Header -> HeaderSource

Obtaining all fields with DKIM algorithm.

Functions to manipulate Field

fieldValueFolded :: Field -> RawFieldValueSource

Obtaining folded (raw) field value.

fieldValueUnfolded :: Field -> RawFieldValueSource

Obtaining unfolded (removing CRLF) field value.

Functions to manipulate Body

fromBody :: Body -> BuilderSource

Obtaining body.

fromBodyWith :: (ByteString -> ByteString) -> Body -> BuilderSource

Obtaining body with a canonicalization function.

removeTrailingEmptyLine :: Body -> BodySource

Removing trailing empty lines.

Special function for DomainKeys and DKIM

parseTaggedValue :: RawFieldValue -> [(ByteString, ByteString)]Source

Parsing field value of tag=value.