Skip to main content

MessageHandler

Trait MessageHandler 

Source
pub trait MessageHandler: Send + Sync {
    // Required methods
    fn handle<'a>(&'a self, message: &'a EmailMessage) -> HandlerFuture<'a>;
    fn name(&self) -> &str;

    // Provided method
    fn reject_reply(&self) -> Option<(u16, String)> { ... }
}
Expand description

Trait for message handlers that process incoming emails.

Unlike [StorageEngine], this trait only handles the inbound direction (receiving/storing), making it suitable for both storage backends and queue-based destinations like Redis.

Required Methods§

Source

fn handle<'a>(&'a self, message: &'a EmailMessage) -> HandlerFuture<'a>

Handles an incoming email message.

Source

fn name(&self) -> &str

Returns the name of this handler.

Provided Methods§

Source

fn reject_reply(&self) -> Option<(u16, String)>

Returns the SMTP reply (code, message) for handlers that refuse every delivery, or None for handlers that accept messages.

Implementors§