Module Async_smtp__.Test_helper
type 'a smtp_flags= ?tls:bool -> 'atype '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 ] -> 'atype '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.tHelper for creating SMTP Envelopes
val smtp : (Async_smtp_types.Smtp_envelope.t list -> unit Async.Deferred.t) client_flags server_flags smtp_flagsAttempt 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_flagsLike
smtpbut instead of the mailcore client you describe the client behaviour allowing testing server behaviour in edge cases.Use
clientto submit requests to the server, andserverto 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_flagsLike
manual_clientbut you provide the server side of the protocol.Use
clientto document expected requests, andserverto send the responses.