Module Async_smtp.Server_callbacks.Simple

Simple provides a basic plugin implementation of S to be used as the foundation for a plugin that overrides only specific callbacks.

val session_connect : log:Mail_log.t ‑> session:Types.Session.t ‑> [ `Accept of string | `Disconnect of Types.Reply.t option ] Async.Deferred.t

session_connect is called when a client first connects, before any messages are accepted.

`Accept greeting initiates a session state and sends the given greeting.

`Disconnect maybe_reply terminates the connection sending the given reply. disconnect is NOT called.

val session_helo : log:Mail_log.t ‑> session:Types.Session.t ‑> string ‑> [ `Continue of [ `Advertise_auth of bool ] | `Deny of Types.Reply.t | `Disconnect of Types.Reply.t option ] Async.Deferred.t

session_helo is called in response to initial handshakes (i.e. HELO or EHLO).

`Continue advertise_auth will update the session state and optionally advertise "AUTH LOGIN" as an extension

`Deny reply will send the given reply but leave the session open.

`Disconnect maybe_reply will send the given reply and close the session (disconnect is not called)

val process_sender : log:Mail_log.t ‑> session:Types.Session.t ‑> Types.Sender.t ‑> sender_args:Types.Argument.t list ‑> [ `Continue | `Reject of Types.Reply.t ] Async.Deferred.t

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

`Continue creates an envelope that is filled in by subsequent commands.

`Reject reply will abort this message.

val process_recipient : log:Mail_log.t ‑> session:Types.Session.t ‑> sender:Types.Sender.t ‑> sender_args:Types.Argument.t list ‑> Types.Email_address.t ‑> [ `Continue | `Reject of Types.Reply.t ] Async.Deferred.t

process_recipient is called in the event of a "RCPT TO" SMTP command. `Continue augments the envelope in the pipeline and passes it on to the next phase. `Reject reply pass through an unmodified envelope to the next phase, omitting this address from the recipients list.

val process_envelope : log:Mail_log.t ‑> session:Types.Session.t ‑> Types.Envelope.t ‑> [ `Consume of string | `Reject of Types.Reply.t | `Send of Types.Envelope_with_next_hop.t list | `Quarantine of Types.Envelope_with_next_hop.t list * Types.Reply.t * string ] Async.Deferred.t

Called after the message body has been received:

`Consume ok_msg will discard the message and return 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 (or a response).

`Reject reply will discard the message and return an error reply to the client. It should be used when the plugin does not wish to process this message.

`Send envelopes_to_relay will spool the given envelopes for further sending and give a successful response, once these messages have been safely spooled.

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

val check_authentication_credentials : log:Mail_log.t ‑> username:string ‑> password:string ‑> [ `Allow | `Deny ] Async.Deferred.t

check_authentication_credentials is called to check if the credentials that the client has provided are valid.

`Allow means that the client's credentials are valid.

`Deny means that the client's credentials are not valid.

val rpcs : unit Async.Rpc.Implementation.t list