(*--------------------------------------------------------------------------- Copyright (c) 2025 Anil Madhavapeddy. All rights reserved. SPDX-License-Identifier: ISC ---------------------------------------------------------------------------*) (** EmailSubmission type as defined in RFC 8621 Section 7 @canonical Jmap.Proto.Submission *) (** {1 EmailSubmission Properties} Polymorphic variants for type-safe property selection in EmailSubmission/get requests. These correspond to the properties defined in RFC 8621 Section 7. *) (** All EmailSubmission properties that can be requested. *) type property = [ | `Id | `Identity_id | `Email_id | `Thread_id | `Envelope | `Send_at | `Undo_status | `Delivery_status | `Dsn_blob_ids | `Mdn_blob_ids ] val property_to_string : [< property ] -> string (** Convert a property to its wire name (e.g., [`Identity_id] -> "identityId"). *) val property_of_string : string -> property option (** Parse a property name, case-sensitive. *) (** {1 Address} *) (** An address with optional SMTP parameters. *) module Address : sig type t = { email : string; (** The email address. *) parameters : (string * string) list option; (** Optional SMTP parameters. *) } val email : t -> string val parameters : t -> (string * string) list option val jsont : t Jsont.t end (** {1 Envelope} *) (** SMTP envelope. *) module Envelope : sig type t = { mail_from : Address.t; (** MAIL FROM address. *) rcpt_to : Address.t list; (** RCPT TO addresses. *) } val mail_from : t -> Address.t val rcpt_to : t -> Address.t list val jsont : t Jsont.t end (** {1 Delivery Status} *) (** Status of delivery to a recipient. *) module Delivery_status : sig type delivered = [ | `Queued | `Yes | `No | `Unknown ] type displayed = [ | `Unknown | `Yes ] type t = { smtp_reply : string; (** The SMTP reply string. *) delivered : delivered; (** Delivery status. *) displayed : displayed; (** MDN display status. *) } val smtp_reply : t -> string val delivered : t -> delivered val displayed : t -> displayed val jsont : t Jsont.t end (** {1 Undo Status} *) type undo_status = [ | `Pending | `Final | `Canceled ] val undo_status_jsont : undo_status Jsont.t (** {1 EmailSubmission} *) type t = { id : Proto_id.t option; (** Server-assigned submission id. *) identity_id : Proto_id.t option; (** The identity used to send. *) email_id : Proto_id.t option; (** The email that was submitted. *) thread_id : Proto_id.t option; (** The thread of the submitted email. *) envelope : Envelope.t option; (** The envelope used, if different from email headers. *) send_at : Ptime.t option; (** When the email was/will be sent. *) undo_status : undo_status option; (** Whether sending can be undone. *) delivery_status : (string * Delivery_status.t) list option; (** Delivery status per recipient. *) dsn_blob_ids : Proto_id.t list option; (** Blob ids of received DSN messages. *) mdn_blob_ids : Proto_id.t list option; (** Blob ids of received MDN messages. *) } val id : t -> Proto_id.t option val identity_id : t -> Proto_id.t option val email_id : t -> Proto_id.t option val thread_id : t -> Proto_id.t option val envelope : t -> Envelope.t option val send_at : t -> Ptime.t option val undo_status : t -> undo_status option val delivery_status : t -> (string * Delivery_status.t) list option val dsn_blob_ids : t -> Proto_id.t list option val mdn_blob_ids : t -> Proto_id.t list option val jsont : t Jsont.t (** {1 Filter Conditions} *) module Filter_condition : sig type t = { identity_ids : Proto_id.t list option; email_ids : Proto_id.t list option; thread_ids : Proto_id.t list option; undo_status : undo_status option; before : Ptime.t option; after : Ptime.t option; } val jsont : t Jsont.t end