Skip to main content

EmailSender

Trait EmailSender 

Source
pub trait EmailSender: Send + Sync {
    // Required method
    fn send<'a>(
        &'a self,
        message: &'a EmailMessage,
    ) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'a>>;
}
Expand description

Abstraction over email delivery.

Implementors are responsible for the actual transport (SMTP, SES, SendGrid, etc.). The library provides LogEmailSender for development, which prints the message to the tracing log instead of delivering it, and NoopEmailSender as the silent default for embedded integrators that do not need email.

Implement this trait and pass it to the builder when email delivery is needed (password reset, email verification, etc.).

Required Methods§

Source

fn send<'a>( &'a self, message: &'a EmailMessage, ) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'a>>

Implementations on Foreign Types§

Source§

impl<T: EmailSender + ?Sized> EmailSender for Arc<T>

Allow any Arc<T> where T: EmailSender to be used as an EmailSender.

This enables sharing a single sender instance (e.g. Arc<dyn EmailSender>) across multiple owners (e.g. tenant handles and route state) without copying the underlying implementation.

Source§

fn send<'a>( &'a self, message: &'a EmailMessage, ) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'a>>

Implementors§