email_message is a library that defines types that represent an RFC2822 email.
You can use Email.of_string to parse an email (e.g. from a ".eml" file).
Once you have your hands on an Email.t, you can use various functions in the Email.Simple and Email modules to inspect parts of the email. For example:
Email.Simple.subject : the subject of the emailEmail.Simple.from : the From header sender of the emailEmail.headers : all the email headersEmail.Simple.all_attachments the email attachmentsThe Email.Simple module exposes various functions for constructing an email. For example:
Email.Simple.create
~from:(Email_address.of_string "sender@example.com")
~to_:[ (Email_address.of_string "recipient@example.com") ]
~subject:"Example email"
(Email.Simple.Content.text_utf8 "This is an example email.")