Installation
Clone the repository, configure it and start the server with Bun, Node or Docker.
Any package manager works. The project's own scripts use Bun.
Get the code
The Node mail server lives in server/. Helper scripts are in scripts/.
Option 1: guided setup
The setup script asks three questions, writes server/.env and generates your DNS records.
It asks for:
- The mail server's domain name (it creates
mx.andmail.hostnames from it). - The mail server's IP address.
- The domain that this server will handle mail for.
It then builds the project with tsc and writes server/records.json. See DNS records for what to do with it.
Needs the TypeScript compiler
The script runs tsc -p ., so tsc has to be on your PATH. Install it with bun add -g typescript or npm install -g typescript if it is missing.
Option 2: manual setup
Start it:
If bun run start cannot bind the ports, run it with elevated rights:
If you see Cannot find module '@/...'
The code uses the @/ path alias, and TypeScript does not rewrite aliases in its output. If node build/main.js fails with this error, run the TypeScript source with Bun instead: bun src/main.ts from the server/ folder. The Docker image does the same.
Ports 25 and 587 are below 1024, so on Linux the process needs root or the CAP_NET_BIND_SERVICE capability.
Option 3: Docker
See Docker Compose for what each service does.
What starts
Starting the server loads server/config/mail.config.json and server/config/smtp-messages.json, then opens these listeners:
| Listener | Port | Role | Starts when |
|---|---|---|---|
IncomingServerConfig | 25 | Receives mail for your domains. | Always |
OutgoingServerConfig | 587 | Accepts authenticated mail for delivery. | Always |
BounceServerConfig | 2525 | Receives bounce reports. | BOUNCE_SMTP_PORT is not 0 |
BounceWebhookServerConfig | 8025 | KumoMTA events and the suppression list. | BOUNCE_WEBHOOK_TOKEN is set |
ApiServerConfig | 8080 | The JSON send API. | MAIL_API_TOKEN is set |
Mail is delivered directly from this machine unless you set OUTBOUND_DRIVER. See Outbound drivers. The config files are described in Configuration files.