Simple Mail Transfer Gateway. Send Mail over HTTP
Find a file
Max Bossing b3252ecd15
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
chore(cargo): update cargo dependencies
2026-02-09 14:19:30 +01:00
src fix(all): remove warnings to make ci pass lol 2026-02-09 12:56:44 +01:00
.gitignore init 2026-01-30 19:48:58 +01:00
.woodpecker.yaml fix(ci): fix ci image name 2026-02-09 14:08:13 +01:00
Cargo.lock chore(cargo): update cargo dependencies 2026-02-09 14:19:30 +01:00
Cargo.toml chore(cargo): lowercase project name 2026-02-09 13:59:18 +01:00
config.example.toml init 2026-01-30 19:48:58 +01:00
LICENSE init 2026-01-30 19:48:58 +01:00
README.md [skip ci]chore(readme): fix ci badge 2026-02-09 14:17:28 +01:00
renovate.json chore: add rennovate.json 2026-01-30 19:54:55 +01:00

SMTP - Simple Mail Transfer Gateway

status-badge

I recently had some problems with hosting providers blocking SMTP connections, and a very specific one where ipv6 smtp traffic wasn't possible, but http was. This is my solution

Installation

SMTG is a single compiled binary with no special dependencies except glibc (and not even that if you compile with the right toolchain, but because of hardware limits CI only builds for glibc). Go to the latest release, grab the binary and simply start it.

Configuration

SMTG has to be configured with a config file. The location of the file has to be passed as the first (and only!) argument to the SMTG command. Have a look at config.example.toml for an example.

Sending mail via http

It's incredibly simple, really. Just POST agains /send this json body:

{
  "from": "noreply@example.com",
  "to": "alice@example.com",
  "name": "Alice",
  "subject": "I'm sending this mail using SMTG!",
  "message": "This could be a simple string, or full blown email HTML. Do what you please!"
}

If everything goes right, you'll get this back:

{
  "data": {
    "to": "alice@example.com",
    "from": "noreply@example.com",
    "name": "Alice",
    "subject": "I'm sending this mail using SMTG!",
    "message": "This could be a simple string, or full blown email HTML. Do what you please!"
  }
}

If anything goes wrong while sending the mail, you'll get this:

{
  "error": {
    "error_code": 4,
    "message": "Failed to send Email. Check logs for error message",
    "data": "could not send SMTP mail"
  }
}

TODO: data should at some point actually contain some useful information, but I currently don't know how I can get those from the mailer api. Sorry!

Authorization using Headers

SMTG has rudimentary support for header authentication. If you set auth.secret to something, it will compare that to the Authorization header of the request, and only allow those with the correct header.

License

AGPL, have fun!