package async_smtp

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t
val smtp_envelope_info : t -> Async_smtp_types.Smtp_envelope.Info.t

mail_from is called in the event of a "MAIL FROM" SMTP command.

Ok t creates an envelope that is updated by rcpt_to and finally processed by data.

Error err sends the reject (or service_unavailable)

rcpt_to is called in the event of a "RCPT TO" SMTP command.

Ok t augments the envelope in the pipeline and passes it on to the next phase.

Error err sends the reject (or service_unavailable).

val accept_data : log:Async.Log.t -> Session.t -> t -> t Smtp_monad.t

accept_data is called when the DATA command is received to decide whether or not to accept the message data.

val process : log:Async.Log.t -> Session.t -> t -> Async_smtp_types.Email.t -> [ `Consume of string | `Send of Async_smtp_types.Smtp_envelope.Routed.Batch.t list | `Quarantine of Async_smtp_types.Smtp_envelope.Routed.Batch.t list * Smtp_reply.t * Async_smtp__.Quarantine_reason.t ] Smtp_monad.t

process is called when the message body has been received (after the DATA command and accept_data).

Ok (`Consume ok_msg drops the message and returns a successful response to the client. It should be used if this plugin has processed the message and does not intend to relay the message.

Error err drops the message and returns an error reply to the client. It should be used when the plugin does not wish to process this message.

Ok (`Send envelopes_to_relay) spools the given envelopes for further sending and gives a successful response, once these messages have been safely spooled.

Ok (`Quarantine (envelopes_to_quarantine, reply, reason)) saves the given messages to a directory for manual inspection and passes through the given reply to the client. reason is used only internally to tell us what check failed.