···
(** Represents an email address with an optional name.
@see <https://www.rfc-editor.org/rfc/rfc8621.html#section-4.1.2.3> RFC 8621, Section 4.1.2.3 *)
+
module Email_address : sig
+
(** Get the display name for the address (if any) *)
+
val name : t -> string option
+
(** Get the email address *)
+
val email : t -> string
+
(** Create a new email address *)
(** Represents a group of email addresses.
@see <https://www.rfc-editor.org/rfc/rfc8621.html#section-4.1.2.4> RFC 8621, Section 4.1.2.4 *)
+
module Email_address_group : sig
+
(** Get the name of the group (if any) *)
+
val name : t -> string option
+
(** Get the list of addresses in the group *)
+
val addresses : t -> Email_address.t list
+
(** Create a new address group *)
+
addresses:Email_address.t list ->
(** Represents a header field (name and raw value).
@see <https://www.rfc-editor.org/rfc/rfc8621.html#section-4.1.3> RFC 8621, Section 4.1.3 *)
+
module Email_header : sig
+
(** Get the header field name *)
+
(** Get the raw header field value *)
+
val value : t -> string
+
(** Create a new header field *)
(** Represents a body part within an Email's MIME structure.
@see <https://www.rfc-editor.org/rfc/rfc8621.html#section-4.1.4> RFC 8621, Section 4.1.4 *)
+
module Email_body_part : sig
+
(** Get the part ID (null only for multipart types) *)
+
val id : t -> string option
+
(** Get the blob ID (null only for multipart types) *)
+
val blob_id : t -> id option
+
(** Get the size of the part in bytes *)
+
(** Get the list of headers for this part *)
+
val headers : t -> Email_header.t list
+
(** Get the filename (if any) *)
+
val name : t -> string option
+
(** Get the MIME type *)
+
val mime_type : t -> string
+
(** Get the charset (if any) *)
+
val charset : t -> string option
+
(** Get the content disposition (if any) *)
+
val disposition : t -> string option
+
(** Get the content ID (if any) *)
+
val cid : t -> string option
+
(** Get the list of languages (if any) *)
+
val language : t -> string list option
+
(** Get the content location (if any) *)
+
val location : t -> string option
+
(** Get the sub-parts (only for multipart types) *)
+
val sub_parts : t -> t list option
+
(** Get any other requested headers (header properties) *)
+
val other_headers : t -> Yojson.Safe.t string_map
+
(** Create a new body part *)
+
headers:Email_header.t list ->
+
?language:string list ->
+
?other_headers:Yojson.Safe.t string_map ->
(** Represents the decoded value of a text body part.
@see <https://www.rfc-editor.org/rfc/rfc8621.html#section-4.1.4> RFC 8621, Section 4.1.4 *)
+
module Email_body_value : sig
+
(** Get the decoded text content *)
+
val value : t -> string
+
(** Check if there was an encoding problem *)
+
val has_encoding_problem : t -> bool
+
(** Check if the content was truncated *)
+
val is_truncated : t -> bool
+
(** Create a new body value *)
+
?encoding_problem:bool ->
+
(** Type to represent email message flags/keywords.
+
@see <https://www.rfc-editor.org/rfc/rfc8621.html#section-4.1.1> RFC 8621, Section 4.1.1 *)
+
(** Represents different types of JMAP keywords *)
+
| Draft (** "$draft": The Email is a draft the user is composing *)
+
| Seen (** "$seen": The Email has been read *)
+
| Flagged (** "$flagged": The Email has been flagged for urgent/special attention *)
+
| Answered (** "$answered": The Email has been replied to *)
+
(* Common extension keywords from RFC 5788 *)
+
| Forwarded (** "$forwarded": The Email has been forwarded *)
+
| Phishing (** "$phishing": The Email is likely to be phishing *)
+
| Junk (** "$junk": The Email is spam/junk *)
+
| NotJunk (** "$notjunk": The Email is explicitly marked as not spam/junk *)
+
| Custom of string (** Arbitrary user-defined keyword *)
+
(** A set of keywords applied to an email *)
+
(** Check if an email has the draft flag *)
+
val is_draft : t -> bool
+
(** Check if an email has been read *)
+
val is_seen : t -> bool
+
(** Check if an email has neither been read nor is a draft *)
+
val is_unread : t -> bool
+
(** Check if an email has been flagged *)
+
val is_flagged : t -> bool
+
(** Check if an email has been replied to *)
+
val is_answered : t -> bool
+
(** Check if an email has been forwarded *)
+
val is_forwarded : t -> bool
+
(** Check if an email is marked as likely phishing *)
+
val is_phishing : t -> bool
+
(** Check if an email is marked as junk/spam *)
+
val is_junk : t -> bool
+
(** Check if an email is explicitly marked as not junk/spam *)
+
val is_not_junk : t -> bool
+
(** Check if a specific custom keyword is set *)
+
val has_keyword : t -> string -> bool
+
(** Get a list of all custom keywords (excluding system keywords) *)
+
val custom_keywords : t -> string list
+
(** Add a keyword to the set *)
+
val add : t -> keyword -> t
+
(** Remove a keyword from the set *)
+
val remove : t -> keyword -> t
+
(** Create an empty keyword set *)
+
(** Create a new keyword set with the specified keywords *)
+
val of_list : keyword list -> t
+
(** Get the string representation of a keyword as used in the JMAP protocol *)
+
val to_string : keyword -> string
+
(** Parse a string into a keyword *)
+
val of_string : string -> keyword
+
(** Convert keyword set to string map representation as used in JMAP *)
+
val to_map : t -> bool string_map
+
(** Represents an Email object.
+
@see <https://www.rfc-editor.org/rfc/rfc8621.html#section-4.1> RFC 8621, Section 4.1 *)
+
(** ID of the blob containing the raw message *)
+
(** ID of the thread this email belongs to *)
+
val thread_id : t -> id
+
(** The set of mailbox IDs this email belongs to *)
+
val mailbox_ids : t -> bool id_map
+
(** The set of keywords/flags for this email *)
+
val keywords : t -> Keywords.t
+
(** Size of the message in bytes *)
+
(** When the message was received by the server *)
+
val received_at : t -> date
+
(** Create a new Email object *)
+
mailbox_ids:bool id_map ->