Module Async_smtp__.Test_helper
type 'a smtp_flags
= ?tls:bool -> 'a
type 'a server_flags
= ?max_message_size:Core.Byte_units.t -> ?malformed_emails:[ `Reject | `Wrap ] -> ?server_log:[ Async.Log.Level.t | `None ] -> ?plugin:(module Async_smtp__.Server.Plugin.S with type State.t = unit) -> ?plugin_log:[ Async.Log.Level.t | `None ] -> 'a
type 'a client_flags
= ?credentials:Async_smtp__.Credentials.t -> ?client_greeting:string -> ?client_log:[ Async.Log.Level.t | `None ] -> 'a
val envelope : ?sender:string -> ?recipients:string list -> ?data:string -> unit -> Async_smtp_types.Smtp_envelope.t
Helper for creating SMTP Envelopes
val smtp : (Async_smtp_types.Smtp_envelope.t list -> unit Async.Deferred.t) client_flags server_flags smtp_flags
Attempt to send the given envelope to a dummy server. Expect test output will be the SMTP session transcript with the following format: < EHLO Client > 200 Server Response Custom plugin output
val manual_client : ((client:(string -> unit Async.Deferred.t) -> server:(string -> unit Async.Deferred.t) -> unit Async.Deferred.t) -> unit Async.Deferred.t) server_flags smtp_flags
Like
smtp
but instead of the mailcore client you describe the client behaviour allowing testing server behaviour in edge cases.Use
client
to submit requests to the server, andserver
to document the expected responses.Example
manual_client (fun ~client ~server -> server "220 [SMTP TEST SERVER]" >>= fun () -> client "EHLO test" >>= fun () -> server "250-Ok: Continue, extensions follow:\n\ 250 8BITMIME" >>= fun () -> client "RESET" >>= fun () -> server "250 Ok: continue" >>= fun () -> client "QUIT" >>= fun () -> server "221 closing connection" )
val manual_server : (Async_smtp_types.Smtp_envelope.t list -> (client:(string -> unit Async.Deferred.t) -> server:(string -> unit Async.Deferred.t) -> unit Async.Deferred.t) -> unit Async.Deferred.t) client_flags smtp_flags
Like
manual_client
but you provide the server side of the protocol.Use
client
to document expected requests, andserver
to send the responses.