This repository has no description
1(*---------------------------------------------------------------------------
2 Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3 SPDX-License-Identifier: ISC
4 ---------------------------------------------------------------------------*)
5
6(** Email address types as defined in RFC 8621 Section 4.1.2.3
7
8 @canonical Jmap.Proto.Email_address *)
9
10(** {1 Email Address} *)
11
12(** An email address with optional display name. *)
13type t = {
14 name : string option;
15 (** The display name (from the phrase in RFC 5322). *)
16 email : string;
17 (** The email address (addr-spec in RFC 5322). *)
18}
19
20val create : ?name:string -> string -> t
21(** [create ?name email] creates an email address. *)
22
23val name : t -> string option
24val email : t -> string
25
26val equal : t -> t -> bool
27val pp : Format.formatter -> t -> unit
28
29val jsont : t Jsont.t
30(** JSON codec for email addresses. *)
31
32(** {1 Address Groups} *)
33
34(** A group of email addresses with an optional group name. *)
35module Group : sig
36 type address = t
37
38 type t = {
39 name : string option;
40 (** The group name, or [None] for ungrouped addresses. *)
41 addresses : address list;
42 (** The addresses in this group. *)
43 }
44
45 val create : ?name:string -> address list -> t
46
47 val name : t -> string option
48 val addresses : t -> address list
49
50 val jsont : t Jsont.t
51end