pub trait ReceiverHandler {
Show 22 methods fn get_stage(&self) -> Stage; fn generate_sasl_callback(&self) -> CallbackWrap; fn on_accept<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        ctx: &'life1 mut ReceiverContext,
        args: AcceptArgs
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait
; fn on_starttls<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        ctx: &'life1 mut ReceiverContext
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait
; fn on_post_tls_handshake<'life0, 'async_trait>(
        &'life0 mut self,
        sni: Option<String>,
        protocol_version: ProtocolVersion,
        cipher_suite: CipherSuite,
        peer_certificates: Option<Vec<Certificate>>,
        alpn_protocol: Option<Vec<u8>>
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
; fn on_auth<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        ctx: &'life1 mut ReceiverContext,
        args: AuthArgs
    ) -> Pin<Box<dyn Future<Output = Option<Reply>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait
; fn on_post_auth<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        ctx: &'life1 mut ReceiverContext,
        result: Result<(), AuthError>
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait
; fn on_helo<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        ctx: &'life1 mut ReceiverContext,
        args: HeloArgs
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait
; fn on_ehlo<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        ctx: &'life1 mut ReceiverContext,
        args: EhloArgs
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait
; fn on_mail_from<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        ctx: &'life1 mut ReceiverContext,
        args: MailFromArgs
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait
; fn on_rcpt_to<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        ctx: &'life1 mut ReceiverContext,
        args: RcptToArgs
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait
; fn on_message<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        ctx: &'life1 mut ReceiverContext,
        stream: impl 'async_trait + Stream<Item = Result<Vec<u8>, Error>> + Send + Unpin
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait
; fn on_hard_error<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        ctx: &'life1 mut ReceiverContext,
        reply: Reply
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait
; fn on_soft_error<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        ctx: &'life1 mut ReceiverContext,
        reply: Reply
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait
; fn on_rset<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
; fn on_data<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: Send + 'async_trait,
        'life0: 'async_trait
, { ... } fn on_quit<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: Send + 'async_trait,
        'life0: 'async_trait
, { ... } fn on_noop<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: Send + 'async_trait,
        'life0: 'async_trait
, { ... } fn on_help<'life0, 'async_trait>(
        &'life0 mut self,
        __arg1: UnparsedArgs
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: Send + 'async_trait,
        'life0: 'async_trait
, { ... } fn on_unknown<'life0, 'async_trait>(
        &'life0 mut self,
        buffer: Vec<u8>
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: Send + 'async_trait,
        'life0: 'async_trait
, { ... } fn on_bad_sequence<'life0, 'async_trait>(
        &'life0 mut self,
        __arg1: (Verb, Stage)
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: Send + 'async_trait,
        'life0: 'async_trait
, { ... } fn on_args_error<'life0, 'async_trait>(
        &'life0 mut self,
        __arg1: ParseArgsError
    ) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>
    where
        Self: Send + 'async_trait,
        'life0: 'async_trait
, { ... }
}
Expand description

Trait to implement to handle the SMTP commands in pair with the Receiver.

Required Methods§

The Receiver does not store the context. This function is called after each command to get the context stage.

Create an instance capable to handle the SASL handshake.

Called when the client connects to the server.

Called after receiving a Verb::StartTls command.

fn on_post_tls_handshake<'life0, 'async_trait>(
    &'life0 mut self,
    sni: Option<String>,
    protocol_version: ProtocolVersion,
    cipher_suite: CipherSuite,
    peer_certificates: Option<Vec<Certificate>>,
    alpn_protocol: Option<Vec<u8>>
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
    Self: 'async_trait,
    'life0: 'async_trait,

Called after a successful TLS handshake.

Called after receiving a Verb::Auth command.

fn on_post_auth<'life0, 'life1, 'async_trait>(
    &'life0 mut self,
    ctx: &'life1 mut ReceiverContext,
    result: Result<(), AuthError>
) -> Pin<Box<dyn Future<Output = Reply> + Send + 'async_trait>>where
    Self: 'async_trait,
    'life0: 'async_trait,
    'life1: 'async_trait,

Called after a successful SASL handshake.

Called after receiving a Verb::Helo command.

Called after receiving a Verb::Ehlo command.

Called after receiving a Verb::MailFrom command.

Called after receiving a Verb::RcptTo command.

Called after receiving a Verb::Data command. The stream is the body of the message, with dot-stuffing handled. The stream return None when the message is finished (.<CRLF>).

Called when the number of reply considered as error reached a threshold (hard).

Called when the number of reply considered as error reached a threshold (soft).

Called after receiving a Verb::Rset command.

Provided Methods§

Called after receiving a Verb::Data command.

Called after receiving a Verb::Quit command.

Called after receiving a Verb::Noop command.

Called after receiving a Verb::Help command.

Called after receiving an unknown command (unrecognized or unimplemented).

Called when the stage of the transaction (obtained with get_stage) and the command are not compatible.

Called when an argument of a command is invalid.

Implementors§