Skip to content

About

sendmail binary for WASIX and wasmer Edge

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

88 Commits

Folders and files

Repository files navigation

wasix-sendmail

A sendmail-compatible email sender with multiple backends.

Features

  • Supports all common sendmail flags
  • Multiple backends: SMTP relay, REST API, and file output

Building for WASIX

You need a wasix toolchain installed for this to work. Run cargo install cargo-wasix or follow the instructions at https://github.com/wasix-org/cargo-wasix.

Build the WASM module:

cargo wasix build --release

This compiles the project to target/wasm32-wasmer-wasi/release/sendmail.wasm. You can then run that binary either directly or via the supplied wasmer.toml (wasmer run .)

Usage

Read email from stdin and send:

echo "Subject: Test\n\nBody" | sendmail recipient@example.com

Read recipients from email headers:

echo "To: user@example.com\nSubject: Test\n\nBody" | sendmail -t

Set envelope sender:

echo "Subject: Test\n\nBody" | sendmail -f sender@example.com recipient@example.com

Configuration

The backend is selected automatically based on which environment variables are set.

1. File Backend (highest priority)

For debugging and testing:

  • SENDMAIL_FILE_PATH - Path to output file where emails will be written

2. SMTP Relay Backend (second highest priority)

For sending via an SMTP relay:

  • SENDMAIL_RELAY_HOST - SMTP relay hostname (required)
  • SENDMAIL_RELAY_PORT - SMTP relay port (default: 587)
  • SENDMAIL_RELAY_PROTO - Protocol (e.g., tls, starttls, plain, opportunistic) (default: opportunistic)
  • SENDMAIL_RELAY_USER - Username for authentication (optional)
  • SENDMAIL_RELAY_PASS - Password for authentication (optional)

If a username or password is specified, you also need to specify the other one.

3. REST API Backend (lowest priority)

For sending via a custom REST API:

  • SENDMAIL_API_URL - URL of the mail endpoint (required)
  • SENDMAIL_API_SENDER - Default sender address (required)
  • SENDMAIL_API_TOKEN - Authentication token (required)

Note: When deploying to wasmer edge the environment variables for the REST API will be automatically populated.

Note: If no backend is configured, sendmail will exit with an error.

All three API variables must be set for the REST API backend to be used.

Preparing a release

Releases to sendmail/sendmail are only done via GitHub actions. To make a release follow these steps:

  1. Create a PR to bump the version named release/0.0.0 (with the correct version)
  2. Verify that the CI for that branch passes and merge it.
  3. Manually tag the merge commit with v0.0.0 and push the tag. This will trigger CI to make a release.

About

sendmail binary for WASIX and wasmer Edge

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages