Skip to main content

Crate lettermint_laravel

Crate lettermint_laravel 

Source
Expand description

The official Lettermint driver for Laravel for Rust: send email through Lettermint, use the Lettermint API, and receive verified webhook events.

The driver builds on the official Lettermint Rust SDK. Its requests go through Laravel’s HTTP client, so laravel::http::client::fake() fakes them in tests.

Add the service provider:

use std::process::ExitCode;

use laravel::Application;
use lettermint_laravel::LettermintServiceProvider;

fn main() -> ExitCode {
    Application::configure()
        .with_providers(|providers| {
            providers.add(LettermintServiceProvider);
        })
        .run()
}

Then set MAIL_MAILER=lettermint and LETTERMINT_PROJECT_TOKEN, and send email as usual:

use laravel::mail::{self, Message};

mail::to("jane@example.com")
    .send(Message::new().subject("Welcome to Acme").html("<p>Thanks for signing up.</p>"))
    .await?;

The README is the guide.

Re-exports§

pub use lettermint;

Modules§

events
The events the webhook endpoint dispatches.
webhooks
The webhook endpoint: verifies each delivery with the SDK and dispatches its events.

Structs§

LettermintConfig
The lettermint config section: the API tokens, the request timeout and the webhook endpoint.
LettermintMailer
The settings of one mailer that sends through Lettermint.
LettermintServiceProvider
Registers the lettermint mail driver and mailer, the Lettermint client and the webhook endpoint.
LettermintTransport
Sends Laravel email through the Lettermint API, with the Lettermint Rust SDK.
Options
Lettermint options for one email, added with Message::with.
SendError
Lettermint didn’t send an email.
WebhookConfig
The webhook endpoint’s settings.

Enums§

ConfigError
A configuration problem, found when the mailer is created or a webhook arrives.

Constants§

DRIVER
The name of the mail driver, and of the mailer the service provider adds.

Functions§

build_client
A Lettermint client built from the config, which sends its requests with Laravel’s HTTP client.
client
The application’s Lettermint client, which the service provider registers.
register
Registers only the lettermint mail driver, for an application that configures everything else itself.