Supports Web UI management and scheduled tasks,send mail over http
1.1K
https://github.com/chuccp/http2smtp
Send email through HTTP without hard-coding SMTP credentials in every application.
English | 简体中文 | 繁體中文 | 日本語
HTTP2SMTP is a self-hosted HTTP-to-SMTP gateway. Manage SMTP servers, recipients, API tokens and scheduled tasks from the web UI, then send mail from any application with a simple HTTP request.
Important
This release is **not data-compatible with v0.2.x**. If an incompatible installation is detected, the service opens a management-only compatibility page with backup and reset instructions. The old database is not opened or modified. Read [Upgrading from v0.2.x](#upgrading-from-v02x) before upgrading.
/data volume| Dashboard | Add SMTP server |
|---|---|
![]() | ![]() |
| Create API token | Add scheduled task |
|---|---|
![]() | ![]() |
docker/docker-compose.yml mounts docker/data to /data, so configuration, SQLite,
logs and attachments survive container replacement.
cd docker
docker compose up -d
Open http://127.0.0.1:12566 and complete the setup wizard.
Linux or macOS:
docker pull cooge123/http2smtp
docker run -d --name http2smtp -p 12566:12566 -p 12567:12567 -v "$PWD/data:/data" cooge123/http2smtp
Windows PowerShell:
docker run -d --name http2smtp -p 12566:12566 -p 12567:12567 -v "${PWD}\data:/data" cooge123/http2smtp
Check the container and ports:
docker inspect --format '{{.State.Health.Status}}' http2smtp
docker exec http2smtp nc -z -w 2 127.0.0.1 12566
docker exec http2smtp nc -z -w 2 127.0.0.1 12567
The built-in health check always probes the management port. In compatibility mode the public API port is intentionally disabled, so the API-port check fails until the installation is backed up and reset.
Download the archive for your platform from GitHub Releases.
Windows PowerShell:
Invoke-WebRequest `
-Uri "https://github.com/chuccp/http2smtp/releases/latest/download/http2smtp-windows-amd64.tar.gz" `
-OutFile "http2smtp-windows-amd64.tar.gz"
tar -xzf http2smtp-windows-amd64.tar.gz
.\http2smtp.exe
Linux:
wget https://github.com/chuccp/http2smtp/releases/latest/download/http2smtp-linux-amd64.tar.gz
tar -xzf http2smtp-linux-amd64.tar.gz
chmod +x http2smtp
./http2smtp
The release archive contains only the binary. Templates, CSS, JavaScript, icons and locale files are embedded inside it.
./http2smtp -v
./http2smtp --version
Example:
http2smtp version v0.3.0 (linux/amd64)
The release workflow writes the Git tag into version.go before building, so published
binaries always contain their exact release version. Local builds show dev unless a
version is injected.
12567.The management UI and admin API share port 12566. The public mail API uses a separate
port 12567, so it can be exposed without exposing the administration surface.
The container keeps all mutable data under /data:
/data/
config.ini
d-mail.db # default SQLite database
logs/
http2smtp.log # rotated by the built-in logger
YYYY-MM-DD/ # attachment cache
When using MySQL, the database remains external, while configuration, logs and
attachments stay under /data.
For non-Docker deployments, -storage_root (or the storage_root environment variable)
sets the attachment root. A custom storage root also enables file logging at
<storage_root>/logs/http2smtp.log.
The data layout changed substantially. On startup HTTP2SMTP checks the persisted data version before opening the database or running automatic table creation.
An unversioned installation or a mismatched data version starts a management-only compatibility page. The database, models, scheduled jobs and public API do not start, and the old data is not changed.
Before resetting:
config.ini, the SQLite database, the attachment directory and application
logs. For MySQL, take a full database dump.config.ini out of the application directory.HTTP2SMTP never deletes the old configuration, database or attachments automatically.
For Docker, back up the entire host directory mounted at /data.
POST /sendMail on the public API port (12567 by default).
| Field | Type | Required | Description |
|---|---|---|---|
token | string | yes | API token created in the management UI |
subject | string | no | Uses the token default when omitted |
content | string | yes | Plain text or HTML mail content |
recipients | string[] | no | Added to the token's configured recipients |
files | object[] | no | Base64 file objects with name and data |
Configured recipients and request recipients are merged, and duplicate addresses are sent only once. Malformed addresses are skipped. The request fails only when no usable recipient remains.
JSON example:
curl -X POST 'http://127.0.0.1:12567/sendMail' \
-H 'Content-Type: application/json' \
-d '{
"token": "YOUR_TOKEN",
"subject": "Deployment finished",
"content": "<b>Build 42 completed.</b>",
"recipients": ["[email protected]"],
"files": [{
"name": "result.txt",
"data": "BASE64_CONTENT"
}]
}'
Form or multipart example:
curl -X POST 'http://127.0.0.1:12567/sendMail' \
--form 'token=YOUR_TOKEN' \
--form 'subject=Daily report' \
--form 'content=Report attached' \
--form '[email protected]' \
--form 'files=@./report.pdf'
GET example:
curl 'http://127.0.0.1:12567/sendMail?token=YOUR_TOKEN&subject=test&content=hello'
Request-body size is controlled by core.maxbodysize (default 10M; -1 means
unlimited) and applies to JSON, form and multipart requests. The limit measures the
encoded body, so Base64 attachments require additional space.
Configuration precedence is:
defaults → config.ini → CLI flags → environment variables
Common startup flags:
./http2smtp \
-web_port 12566 \
-api_port 12567 \
-storage_root /path/to/storage
A port supplied by a flag or web_port / api_port environment variable is treated as
fixed, which is how Docker prevents the UI from moving a mapped port.
Typical config.ini:
[core]
init = true
dbType = sqlite
dataVersion = 1
maxBodySize = 10M
[sqlite]
filename = d-mail.db
[manage]
port = 12566
[api]
port = 12567
For MySQL, use the [mysql] section with host, port, dbname, username,
password and charset.
Do not change core.dataVersion manually. It describes the complete on-disk layout and is
used by the compatibility guard.
The project is a Go application with no Node/pnpm build step.
go test ./...
go build -tags release -o http2smtp ./
./http2smtp -v
An ordinary go build is a development build and reads templates/static assets from the
working tree. Release builds use -tags release and serve the embedded copies.
webui/embed.go packages the complete interface:
//go:embed templates
var templatesFS embed.FS
//go:embed static
var staticFS embed.FS
The locale JSON files are embedded as well. The release workflow:
go test -tags release ./webui.version.go.-tags release.Latest builds are available from GitHub Releases and Docker Hub.
Telegram: https://t.me/+JClG9_DojaM0ZGE1
Issues and feature requests are welcome in GitHub Issues.
Apache License 2.0. See LICENSE.
Content type
Image
Digest
sha256:07045eb12…
Size
49 MB
Last updated
21 days ago
docker pull cooge123/smtp2http