package mrmime
Module Mailbox.Local
Local part of a mailbox is a non-empty list of word elements. You can construct local-part like this:
let local = Local.(v [ w "romain"; w "calascibetta" ]) ;;
val local : local = [ `Atom "romain"; `Atom "calascibetta" ]Spaces and control characters are allowed in the local-part:
let local = Local.(v [ w "Romain Calascibetta"; w "to+mrmime" ]) ;;
val local : local = [ `String "Romain Calascibetta"; `Atom "to+mrmime" ]
Local.to_string local ;;
- : string = "\"Romain Calascibetta\".to+mrmime"NOTE: + permits your MUA to tag e-mails received with this local-part.
Valid UTF-8 string is allowed according RFC 6532 - and will be surrounded by double-quote.
val w : string -> wordword x tries to normalize x as a `Word according RFC 5322. It returns Error if x does not respect standards. If contents is an UTF-8 contents, word will surround x with double-quote and will escape control characters (see escape_string).
NOTE: UTF-8 is allowed in e-mails according RFC 6532.
val coerce : 'a Mrmime__.Peano.s local -> Rfc822.localcoerce l returns a valid and safe local.
val make : 'a local -> (Rfc822.local, [ `Msg of string ]) resultmake l returns a local only if l is a non-empty list.
val of_list : string list -> (Rfc822.local, [ `Msg of string ]) resultof_list l returns a local-part from a non-empty list of well-formed words. Otherwise, it returns an error.
val v : 'a local -> Rfc822.localSame as make but raises an exception instead to return Error.
val to_string : Rfc822.local -> stringto_string x returns a string which represents x as it is in an e-mail.