Module Netaddress

module Netaddress: sig .. end

Parsing of mail addresses


Addresses indicate the senders and recipients of messages and correspond to either an individual mailbox or a group of mailboxes.

type local_part = string 

Usually the user name

type domain = string 

The domain of the mailbox

type addr_spec = local_part * domain option 

The pair local_part@domain as O'Caml type. The domain may be missing.

class mailbox : ?name:string -> string list -> addr_spec -> object .. end

A mailbox has a name, optionally a route (not used nowadays), and a formal address specification.

class group : string -> mailbox list -> object .. end

A group has a name, and consists of a number of mailboxes.

type t = [ `Group of group | `Mailbox of mailbox ] 

The union of mailbox and group

exception Parse_error of int * string

A parsing error. The int is the position in the parsed string

val parse : string -> t list

Parse a list of addresses in string representation, and return them as list of mailboxes or groups.

Examples:

Old-style naming of mailboxes is not supported (e.g. "gerd@gerd-stolpmann.de (Gerd Stolpmann)" - the part in parentheses is simply ignored.