type raw = | Quoted_printable of (string, [ `Msg of string ]) Stdlib.result |
| Base64 of (string, [ `Msg of string ]) Stdlib.result |
The local part of an e-mail address is composed by two kinds of words:
`Atomis string as is.`Stringis a string surrounded by double-quote to allow white-space.
The second kind is sanitized — we deleted double-quote which surround string.
type local = word listLocal part of e-mail address.
Subset of domain described by RFC5321 which contains 3 kinds of address:
IPv4: a valid IPv4 addressIPv6: a valid IPv6 addressExt (ldh, value): an extended kind of domain recognized byldhidentifier which valus isvalue
Parser of IPv4 and IPv6 was done by Ipaddr. An extended kind Ext needs to be resolved by the client.
Domain part of e-mail address. A domain integrate kinds from RFC5321 (see addr), a domain described by RFC5322 and a `Literal which is the last best-effort value possible as a domain.
Emile does not resolve domain.
A phrase is a sentence to associate a name with an e-mail address or a group of e-mail addresses. `Encoded value is not normalized on the charset specified. The encoded's string is decoded as is only. For example, `Encoded can inform to use KOI-8 encoding (cyrillic charset). However, Emile does not check if value is a valid KOI-8 string, nor normalizes to unicode. Emile just decodes it as is.
Pretty-printers.
type 'a fmt = Stdlib.Format.formatter -> 'a -> unitEqual & Compare.
case_insensitive a b maps values with lowercase_ascii and compare them with String.compare. We do not map UTF8 value.
equal_domains a b apply equal_domain to ordered domains (see compare_domain) between a and b.
equal_mailbox ?case_sensitive a b tests if mailbox a and mailbox b are semantically equal. The user can define if the local-part need to be case-sensitive or not (by case_sensitive). If a xor b has a name, we consider a = b if we have the same local-part and same domain(s). Otherwise, we compare identifier/phrase between them.
compare ?case_sensitive a b compares mailbox a and mailbxo b semantically. We prioritize local-part, domain-part and finally optionnal name.
Parsers
module Parser : sig ... endmodule List : sig ... endval address_of_string_with_crlf : string -> (address, error) Stdlib.resultaddress_of_string_with_crlf s parses s which have the form: local@domain. Named email or multiple-domain email are not handle by this parser. s must terminate with CRLF as the delimiter. If the parser fails, it return an error error.
val address_of_string : string -> (address, error) Stdlib.resultaddress_of_string s parses s which have the form: local@domain. Named email or multiple-domain email are not handle by this function. If the parser fails, it return an error error. It's possible that address_of_string did not consume all s.
val address_of_string_raw : off:int -> len:int -> ?tmp:Bigstringaf.t -> string -> (int * address, error) Stdlib.resultaddress_of_string_raw s off len parses a sub-part of s starting at off and it computes at most len bytes. It returns the email and how many bytes it consumes. Named email or multiple-domain are not handle by this parser. If the parser fails, it return an error error.
If the user has an already allocated Bigstringaf.t, it can use it as an internal buffer to parse given input s.
val set_of_string_with_crlf : string -> (t, error) Stdlib.resultval set_of_string : string -> (t, error) Stdlib.resultval set_of_string_raw : off:int -> len:int -> ?tmp:Bigstringaf.t -> string -> (int * t, error) Stdlib.resultval of_string_with_crlf : string -> (mailbox, error) Stdlib.resultof_string_with_crlf s parses s which can have multiple form:
- Named email
Bobby <bobby@mail.net> - Multiple-domain email
<@laposte.net:bobby@mail.net - Usual form
bobby@mail.net - Surrounded form
<bobby@mail.net>
About named email, the parser handles encoded-word (according RFC 2047) to be able to use a special charset (like UTF-8) to show the name. Parser decodes encoded-word as is and do not do any translation from charset specified to any encoding (eg. translation from latin1 to UTF-8).
s must terminates with CRLF as the delimiter. If the parser fails, it return an error error.
val of_string : string -> (mailbox, error) Stdlib.resultof_string s is of_string_with_crlf but did not need CRLF at the end. It's possible that of_string did not consume all s.
val of_string_raw : off:int -> len:int -> ?tmp:Bigstringaf.t -> string -> (int * mailbox, error) Stdlib.resultof_string_raw s off len is of_string_with_crlf but did not need CRLF at the end. It parses only a sub-part of s starting at off and computes at most len bytes. It returns how many bytes it consumed.
If the user has an already allocated Bigstringaf.t, it can use it as an internal buffer to parse given input s.