package letters

  1. Overview
  2. Docs
Client library for sending emails over SMTP

Install

Dune Dependency

Authors

Maintainers

Sources

letters-0.2.0.tbz
sha256=5cbda38f8c891ae84b55aa27f07d598ea6e0251e4e4bd1435b3fde904efc935a
sha512=06a8612473331bcbcaa6e18743d53e9c3a94f82778ce2883327959c4d4be7b785a975fdad93ae34fd2a15cb1f66635346b10dc54a68cef5fbb0fdd750ff1b9e5

doc/letters/Letters/index.html

Module LettersSource

Sourcemodule Config : sig ... end

Configuration providing needed information to connect to the SMTP server.

Sourcetype body =
  1. | Plain of string
  2. | Html of string
  3. | Mixed of string * string * string option
Sourcetype recipient =
  1. | To of string
  2. | Cc of string
  3. | Bcc of string
Sourceval build_email : from:string -> recipients:recipient list -> subject:string -> body:body -> (Mrmime.Mt.t, string) result

Build an email using mrmime

This function is a helper function to simplify process of building an email with `mrmime`. It will return result type and wraps all exceptions into Error

from string representation of the email proved as a `from` field, this can be a different email address than the config.sender.

recipients list of email recipients

subject the single line string used as the email `subject` field

body string representation of the actual email message that can be either plain text or HTML message

Returns result indicating if built email is valid or Error if anything failed

Sourceval send : config:Config.t -> sender:string -> recipients:recipient list -> message:Mrmime.Mt.t -> unit Lwt.t

Send the previously generated email

This function expects valid configuration, list of recipients and finally a valid `mrmime` representation of the email message.

config valid configuration to connect the SMTP server.

recipients list of valid email addresses.

message valid `mrmime` representation of the email message.

Runs asynchronously using Lwt and retuns unit when the message is sent successfully. If anything fails during the process, throws an exception.

OCaml

Innovation. Community. Security.