wasm-smtp-component 0.14.0

WASM Component Model interface for wasm-smtp (wasm32-wasip2 target).
Documentation

wasm-smtp-component

WASM Component Model interface for wasm-smtp.

Exports the smtp-send WIT interface defined in wit/smtp.wit, enabling any language with WIT bindings (TypeScript, Go, Python, C, …) to send email through wasm-smtp without writing Rust.

Quick start

# Build the .wasm component (requires cargo-component + wasm32-wasip2 target)
cargo component build --target wasm32-wasip2 -p wasm-smtp-component

# Run unit tests on native (no WASM runtime required)
cargo test -p wasm-smtp-component

WIT interface

// wit/smtp.wit (abbreviated)
interface smtp-send {
    send: func(
        config: smtp-config,
        credentials: smtp-credentials,
        message: smtp-message,
    ) -> result<send-result, send-error>;
}

See wit/smtp.wit for the complete interface.

Language bindings

# TypeScript / JavaScript
jco types ../../wit/smtp.wit -o ./types

# Go
wit-bindgen go ../../wit/smtp.wit --out-dir ./smtp_bindings

Building

Prerequisites:

# Install cargo-component
cargo install cargo-component

# Add the WASM target
rustup target add wasm32-wasip2

Then:

cargo component build --target wasm32-wasip2 -p wasm-smtp-component
# → target/wasm32-wasip2/debug/wasm_smtp_component.wasm

Security

Credentials are passed as plain strings on each send call and are not retained between calls. See docs/src/component-model.md for the threat model.

License

Apache-2.0. See LICENSE.