Tool to send an email in OCaml according RFC4409 [SUBMIT]
Published: 05 Aug 2019
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.
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).
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.
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.
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.
However, it works (mostly)!