Skip to main content

Crate mailbridge

Crate mailbridge 

Source
Expand description

Provider-neutral transactional email client.

§Example

use mailbridge::{EmailMessage, HyvorRelayProvider, MailClient, MailbridgeConfig};

let config = MailbridgeConfig::from_env()?;
let provider = HyvorRelayProvider::from_config(&config)?;
let client = MailClient::try_from_config(provider, &config).await?;

let message = EmailMessage::builder()
    .from("Hashcode", "no-reply@hashcode-fibration.com")?
    .to("User", "user@example.com")?
    .subject("Relay test")
    .text("This is a test email.")
    .build()?;

let receipt = client.send(message).await?;
println!("{}", receipt.message_id());

§Queue Backends

queue-memory is intended for tests, local development, and workloads that can tolerate losing queued mail on process restart. Use queue-sqlite for single-node durable queueing and queue-postgres for multi-worker durable queueing in applications that already operate PostgreSQL. Use queue-scylla for high-throughput ScyllaDB deployments where bucket count, lease timeout, replication, compaction, and dead-letter retention are tuned by the owning application.

Optional provider flags (sendgrid, sendpulse, mailgun, resend, mailjet, brevo, and bird) add HTTP provider implementations for those transactional email services.

Live durable-backend tests are environment gated:

  • MAILBRIDGE_TEST_POSTGRES_URL for PostgreSQL.
  • MAILBRIDGE_TEST_SCYLLA_URI, MAILBRIDGE_TEST_SCYLLA_KEYSPACE, and MAILBRIDGE_TEST_SCYLLA_TABLE for ScyllaDB.

Structs§

Attachment
BirdConfig
BirdProvider
BrevoConfig
BrevoProvider
EmailAddress
EmailMessage
EmailMessageBuilder
HyvorRelayProvider
MailClient
MailClientBuilder
MailRateLimiter
MailbridgeConfig
MailbridgeConfigBuilder
MailgunConfig
MailgunProvider
MailjetConfig
MailjetProvider
MessageId
PostgresQueue
ProviderCapabilities
QueueHandle
QueueId
QueueItem
QueueWorker
QueueWorkerConfig
QueuedEmail
RateLimitConfig
ResendConfig
ResendProvider
ScyllaQueue
SendGridConfig
SendGridProvider
SendPulseConfig
SendPulseProvider
SendReceipt
SmtpClient
SmtpConfig
SqliteQueue
TelemetryFields

Enums§

DeliveryMode
MailError
MailjetApiVersion
QueueBackend
SendStatus
TelemetryEvent

Traits§

MailProvider
MailQueue

Type Aliases§

Result