package facteur

  1. Overview
  2. Docs
Tool to send an email


Dune Dependency






facteur is a little tool (experimental) to easily send a mail. It is a milestone of several projects to implement the SMTP stack on MirageOS:

  • mrmime: is the main library which can parse and produce a mail according several RFCs. It support multipart and multiple encoding (when it uses as a parser).

  • colombe: is the core library about SMTP protocol (without extension but can be extended) as decoder and encoder.

  • sendmail: is an implementation of the Submission RFC over TLS or with STARTTLS extension. This library is an example to implement several extension on top of colombe.

  • emile: is a little library to parse a mail address according RFCs and provide a [cmdliner][cmdliner] helper. It uses as a cross representation of a mail address between [colombe]colombe (RFC 5321) and [mrmime]mrmime (RFC 5322).

Of course, facteur uses several libraries. mrmime uses rosetta to decode any encoding to Unicode. It uses base64 or pecu as encoder/decoder of bodies. Or angstrom as the main library to describe (a)BNF of emails.

Internal libraries

facteur needs libmagic to be able to recognize kind of your files. It implements a C stubs and depends on an UNIX environment. In other side, facteur has an other internal library, rfc2183 which wants to emit a Content-Disposition field. This library is on top of mrmime.

SMTP details

facteur wants to use two ways to send an email. The first one wraps entirely a SMTP flow with TLS (with [ocaml-tls][ocaml-tls]). The second way is to start a SMTP flow and try to establish a TLS flow with STARTTLS.

Of course, the first way is better than the second. If both are not available, we are not able to send an email.


As we said, this library is really experimental and should not be used in production where it deserves mostly a deep work about API on mrmime or colombe mainly.

However, it works (mostly)!