package maildir

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Library to access mailbox folders in Maildir format

type t

The type of Maildir folders.

type uid = string

The type of message unique identifiers

type flag =
  1. | NEW
  2. | SEEN
  3. | REPLIED
  4. | FLAGGED
  5. | TRASHED
  6. | PASSED
  7. | DRAFT

Message flags

type msg = {
  1. uid : uid;
  2. filename : string;
  3. flags : flag list;
}

A message

val create : ?init:bool -> string -> t

create init path returns an object that can be used to access a Maildir-directory at path. If ?init is true, then the directory path and its subdirectories "tmp", "cur", and "new" will be created if they do not exist. The default is false.

val update : t -> unit

update md updates the cached information to reflect the actual contents of the Maildir folder. This is only needed if more than one program is accessing the folder.

val add : t -> string -> uid

add md data adds the message with contents data. Returns the uid of the newly inserted message.

val get : t -> uid -> string

get md uid retrieves the filename of the message with uid uid.

Raises Not_found if no such message is found.

val remove : t -> uid -> unit

remove md uid removes the message with uid uid.

Raises Not_found if no such message is found.

val set_flags : t -> uid -> flag list -> unit

set_flags md uid flags changes sets the flags of the message with uid uid to flags.

Raises Not_found if no such message is found.

val flags : t -> uid -> flag list

flags md uid returns the list of flags of message with uid uid.

Raises Not_found if no such message is found.

val iter : (msg -> unit) -> t -> unit

iter f md computes f msg1; f msg2; ...; f msgN where msg1, ..., msgN are the messages in md (in some unspecified order).

val fold : (msg -> 'a -> 'a) -> t -> 'a -> 'a

fold f md x computes (f msg1 (f msg2 (... (f msgN x)))) where msg1 ... msgN are the messages in md.

OCaml

Innovation. Community. Security.