Library
Module
Module type
Parameter
Class
Class type
module Config : sig ... end
Configuration providing needed information to connect to the SMTP server.
val create_email :
?reply_to:string ->
from:string ->
recipients:recipient list ->
subject:string ->
body:body ->
unit ->
(Mrmime.Mt.t, string) Stdlib.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
reply_to
specific email address to reply to
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
val build_email :
from:string ->
recipients:recipient list ->
subject:string ->
body:body ->
(Mrmime.Mt.t, string) Stdlib.result
Build an email using mrmime like create_email
Backwards compatible build function without reply_to
val send :
config:Config.t ->
sender:string ->
recipients:recipient list ->
message:Mrmime.Mt.t ->
unit Lwt.t
Send the previously created 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.