package received
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=e191073dd4d984cd63e5a78debbc481e4fa1c5a543c756fedef9f82c40962c73
sha512=6c7279d2df763ec43f09a083feaf8285d4c90df22e9749dc404f8e96d34c5ec7f047b8c54f46c8e9e1d70fda603ab5c3ba3da99333d21c95e16ca9442fd1d573
Description
A little library to parse or emit a Received field according RFC5321. It is able to notify which SMTP server serves the email (and track, by this way, on which way - TLS or not - the email was transmitted).
Published: 18 May 2020
README
Colombe - an implementation of SMTP protocol in OCaml
colombe
is a little library which wants to implement the SMTP protocol according RFC5321. It is a low-level library used by some others projects to implements clients or servers.
The library does not handle properly an email. If you want to generate a proper email or introspect an email, you should be interested by mrmime.
As a client
The distribution provides sendmail
, sendmail.tls
and sendmail-lwt
which are respectively:
An agnostic (to the system) implementation of an usual client with authentication
An agnostic (to the system) implementation of an usual client with authentication and
STARTTLS
extensionAn LWT implementation of an usual client with authentication
Depending on your context:
If you want to communicate with a SMTP server which require a TLS connection (like,
*:465
),sendmail
with a scheduler such as LWT or ASYNC (or UNIX) should be use.sendmail-lwt
is a specialization with LWT.If you want to communicate with a SMTP server which handles (and surely requires)
STARTTLS
extension, (like*:587
),sendmail.tls
which a scheduler should be use.
Of course, a client can be more complex and can handle:
file attachments
a well formed email
some usual metadata such as the timezone
If you are interested by that, you should look into facteur which wants to provide a little binary to send an email with a nice use between colombe
, mrmime
and some others MirageOS projects.
As a server
Of course, colombe
implements both sides. By this library, you are able to implement an SMTP server - if you are interested by that, you should look into ptt.
How to use colombe
As we said, the library wants to be a low-level one. At least, the core does not handle properly eSMTP extensions or any high mechanisms such the authentication. It's mostly because the library wants to be used by a server implementation and a client implementation.
It only ensures a high abstracted interface on top of the low-level of the communication. The library defines only few parts of the SMTP protocol and a monadic interface to describe the state-machine while the communication with an other peer.
sendmail
is a good example about how to use colombe
. It describes structurally the SMTP protocol (only what it really needs) and the state machine to send an email.
Received field
RFC5321 describes the SMTP protocols and some mechanisms such as the Received:
field. The distribution provides a way to introspect Received:
fields (and can produce a graph of them) or generate them from a server configuration.