package email_message

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t = private Email.t
val sexp_of_t : t -> Sexplib0.Sexp.t
val of_email : Email.t -> t
val create_custom : content_type:Mimetype.t -> ?encoding:Octet_stream.Encoding.known -> ?extra_headers:(string * string) list -> string -> t
val create : content_type:Mimetype.t -> ?encoding:Octet_stream.Encoding.known -> ?extra_headers:(string * string) list -> string -> t
  • deprecated [since 2019-08] Renamed to [create_custom]
val html_utf8 : ?encoding:Octet_stream.Encoding.known -> ?extra_headers:(string * string) list -> string -> t
val html : ?encoding:Octet_stream.Encoding.known -> ?extra_headers:(string * string) list -> string -> t
  • deprecated [since 2019-08] Please specify the charset, e.g. [html_utf8]
val text_utf8 : ?encoding:Octet_stream.Encoding.known -> ?extra_headers:(string * string) list -> string -> t
val text : ?encoding:Octet_stream.Encoding.known -> ?extra_headers:(string * string) list -> string -> t
  • deprecated [since 2019-08] Please specify the charset, e.g. [text_utf8]
val text_monospace_utf8 : ?extra_headers:(string * string) list -> ?force_no_line_wrap:bool -> string -> t

Plain text e-mail that also includes an html version so it's displayed monospace in gmail.

By default, we add some custom styling to disable the line-wrap formatting rule which gmail uses. To disable this behavior, supply ~force_no_line_wrap:false.

val text_monospace : ?extra_headers:(string * string) list -> ?force_no_line_wrap:bool -> string -> t
  • deprecated [since 2019-08] Please specify the charset, e.g. [text_monospace_utf8]
val of_file : ?content_type:Mimetype.t -> ?encoding:Octet_stream.Encoding.known -> ?extra_headers:(string * string) list -> string -> t Async.Deferred.t
val alternatives : ?extra_headers:(string * string) list -> t list -> t

Combine 2 or more contents as alternative versions. List should be sorted from worst to best.

val mixed : ?extra_headers:(string * string) list -> t list -> t

Combine 2 or more contents that should be bundled together

Add related resources (e.g. inline images). You can reference them using 'cid:$attachment_name' in the content. To attach files you should use create ~attachments

val content_type : t -> Mimetype.t

The Content-ID of the content

val content : t -> Octet_stream.t option

content and parts return None if the email doesn't properly parse. They also return None if the message has content type "message/rfc822"

val parts : t -> t list option
val alternative_parts : t -> t list

Get the alternative versions available. If the message is not of content type "multipart/alternative" then return a singleton list.

val inline_parts : t -> t list

Get the 'inline' parts, This expands "Content-Type: multipart/mixed,related", stripping out any attachment parts. multipart/alternative is not expanded

val to_file : t -> string -> unit Async.Deferred.Or_error.t

Save content to disk