pub trait MailerPlugin: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn send(&self, msg: Message) -> Result<SendOutcome, MailerError>;
// Provided methods
fn send_batch(&self, msgs: Vec<Message>) -> Vec<BatchOutcome> ⓘ { ... }
fn is_healthy(&self) -> bool { ... }
}Expand description
A plugin that sends transactional email.
All methods are synchronous and return Result values to match
the rest of bext-plugin-api (WASM guests cannot express async
traits today). Async backends bridge by blocking on their own
runtime inside the trait body.
Host functions mailer.send and mailer.send_batch call through
to the currently registered implementation.
Required Methods§
Sourcefn send(&self, msg: Message) -> Result<SendOutcome, MailerError>
fn send(&self, msg: Message) -> Result<SendOutcome, MailerError>
Send a single message. Backends MAY buffer internally but
MUST have handed the message off to the transport before
returning Ok.
Provided Methods§
Sourcefn send_batch(&self, msgs: Vec<Message>) -> Vec<BatchOutcome> ⓘ
fn send_batch(&self, msgs: Vec<Message>) -> Vec<BatchOutcome> ⓘ
Send many messages in one call. Default impl loops over
send; backends that support native
batching (SES SendBulkEmail) override this for efficiency.
Returns one outcome per input message in the same order. A transport-level failure that aborts the whole batch is reflected by every entry carrying the same error kind.
Sourcefn is_healthy(&self) -> bool
fn is_healthy(&self) -> bool
Optional health check. Default: always healthy. Backends that maintain a connection pool (SMTP) override this to probe the pool; API-based backends (SES) usually leave it as-is.