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.
typelocal_part =string
Usually the user name
typedomain =string
The domain of the mailbox
typeaddr_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.
typet =[ `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 listParse a list of addresses in string representation, and return them as list of mailboxes or groups.
Examples:
parse "gerd@gerd-stolpmann.de" returns a single mailbox
without name and route, and the given specparse "Gerd Stolpmann <gerd@gerd-stolpmann.de>" returns a
single mailbox with name and spec, but without routeparse "abc@def.net, ghi" returns two mailboxes without
name and route, and the two specs. The second address only
has a local part, but no domain.parse "g:abc@def.net, Me <me@domain.net>;, gs@npc.de"
returns one group g with members abc@def.net and
me@domain.net, and another mailbox gs@npc.de.Old-style naming of mailboxes is not supported (e.g. "gerd@gerd-stolpmann.de (Gerd Stolpmann)" - the part in parentheses is simply ignored.