Skip to main content

EmailService

Trait EmailService 

Source
pub trait EmailService: Send + Sync {
    // Required methods
    fn send<'life0, 'async_trait>(
        &'life0 self,
        message: EmailMessage,
    ) -> Pin<Box<dyn Future<Output = EmailResult<EmailDeliveryReport>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send_template<'life0, 'life1, 'async_trait>(
        &'life0 self,
        template_name: &'life1 str,
        recipients: Vec<String>,
        template_data: HashMap<String, Value>,
    ) -> Pin<Box<dyn Future<Output = EmailResult<Vec<EmailDeliveryReport>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_delivery_status<'life0, 'life1, 'async_trait>(
        &'life0 self,
        message_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = EmailResult<Option<EmailDeliveryReport>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn cancel_scheduled<'life0, 'life1, 'async_trait>(
        &'life0 self,
        message_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = EmailResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_stats<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = EmailResult<EmailServiceStats>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn validate_config<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = EmailResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn test_connection<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = EmailResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn send_bulk<'life0, 'async_trait>(
        &'life0 self,
        messages: Vec<EmailMessage>,
    ) -> Pin<Box<dyn Future<Output = EmailResult<Vec<EmailDeliveryReport>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Generic email service trait

Required Methods§

Source

fn send<'life0, 'async_trait>( &'life0 self, message: EmailMessage, ) -> Pin<Box<dyn Future<Output = EmailResult<EmailDeliveryReport>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send single email message

Source

fn send_template<'life0, 'life1, 'async_trait>( &'life0 self, template_name: &'life1 str, recipients: Vec<String>, template_data: HashMap<String, Value>, ) -> Pin<Box<dyn Future<Output = EmailResult<Vec<EmailDeliveryReport>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send email using template

Source

fn get_delivery_status<'life0, 'life1, 'async_trait>( &'life0 self, message_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = EmailResult<Option<EmailDeliveryReport>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get delivery status for a message

Source

fn cancel_scheduled<'life0, 'life1, 'async_trait>( &'life0 self, message_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = EmailResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Cancel scheduled email

Source

fn get_stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = EmailResult<EmailServiceStats>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get email service statistics

Source

fn validate_config<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = EmailResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Validate email configuration

Source

fn test_connection<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = EmailResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Test email delivery

Provided Methods§

Source

fn send_bulk<'life0, 'async_trait>( &'life0 self, messages: Vec<EmailMessage>, ) -> Pin<Box<dyn Future<Output = EmailResult<Vec<EmailDeliveryReport>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send multiple email messages (bulk send)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§