A lightweight, production-ready SMTP server that forwards incoming email to the ByteSend API. Deploy it standalone or behind a reverse proxy to accept SMTP connections and integrate with ByteSend's email delivery platform.
- ✅ Simple & Lightweight — Minimal dependencies, ~10 MB Docker image
- ✅ Flexible TLS —
none(behind proxy) ormanual(standalone with certs) - ✅ API Key Auth — Secure SMTP authentication using ByteSend API keys
- ✅ Hot-Reload Certs — Automatic certificate reload on renewal (zero downtime)
- ✅ Multi-Port — Listens on 25 (SMT), 587 (submission), 465 (implicit TLS)
- ✅ Container-Ready — Docker & Kubernetes-friendly
- ✅ Systemd Support — Native Linux service integration
- ✅ Production Logs — Structured logging via stdout/journald
# Clone the repository
git clone https://github.com/NodeByteHosting/ByteSend-SMTP.git
cd ByteSend-SMTP
# Configure docker-compose.yml
# (See docs/self-hosting/smtp-server.mdx for details)
# Start the server
docker compose up -d --build
# Check logs
docker compose logs -f smtp# Clone and install
git clone https://github.com/NodeByteHosting/ByteSend-SMTP.git
cd ByteSend-SMTP
npm install
npm run build
# Run
NODE_ENV=production SMTP_AUTH_USERNAME=bytesend BYTESEND_BASE_URL=https://bytesend.cloud node dist/server.js# Copy service file
sudo cp contrib/bytesend-smtp.service /etc/systemd/system/
# Enable and start
sudo systemctl daemon-reload
sudo systemctl enable bytesend-smtp
sudo systemctl start bytesend-smtpSet environment variables to configure the server:
| Variable | Default | Description |
|---|---|---|
SMTP_AUTH_USERNAME |
bytesend |
Username for SMTP authentication |
BYTESEND_BASE_URL |
https://bytesend.cloud |
ByteSend API endpoint (e.g., https://api.example.com) |
SMTP_TLS_MODE |
none |
TLS mode: none (plain) or manual (with certs) |
SMTP_TLS_CERT_PATH |
— | Path to full certificate chain (PEM format) |
SMTP_TLS_KEY_PATH |
— | Path to private key (PEM format) |
NODE_ENV |
development |
Set to production for production use |
export SMTP_TLS_MODE=manual
export SMTP_TLS_CERT_PATH=/etc/letsencrypt/live/smtp.example.com/fullchain.pem
export SMTP_TLS_KEY_PATH=/etc/letsencrypt/live/smtp.example.com/privkey.pem
node dist/server.js┌─────────────────┐
│ SMTP Clients │
│ (port 25/587) │
└────────┬────────┘
│
[STARTTLS]
│
▼
┌──────────────────────┐
│ SMTP Server │
│ (Node.js) │
│ - Auth │
│ - Parse Email │
│ - Forward to API │
└──────────┬───────────┘
│
▼
┌──────────────┐
│ ByteSend API │
│ /api/v1/... │
└──────────────┘
- 25 — Standard SMTP (plain or STARTTLS)
- 587 — Submission port (plain or STARTTLS)
- 465 — Implicit TLS (SMTPS, manual mode only)
- 2465 & 2587 — Alternative ports for testing/internal use
const nodemailer = require("nodemailer");
const transporter = nodemailer.createTransport({
host: "smtp.example.com",
port: 587,
secure: false,
auth: {
user: "bytesend",
pass: "your_api_key_here",
},
});
transporter.sendMail({
from: "sender@example.com",
to: "recipient@example.com",
subject: "Hello",
text: "Email via ByteSend SMTP",
}, (err, info) => {
console.log(err || info);
});Add to main.cf:
relayhost = smtp.example.com:587
smtp_tls_security_level = encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
Then in /etc/postfix/sasl_passwd:
smtp.example.com:587 bytesend:your_api_key_here
See docs/self-hosting/smtp-server.mdx
See contrib/k8s/deployment.yaml
See docs/self-hosting/smtp-server.mdx
See docs/self-hosting/smtp-server.mdx
- Uses AGPL v3.0 — Must share modifications
- Authenticate with API keys — Store keys securely, rotate regularly
- Enable TLS in production — Use
manualmode with valid certificates or a reverse proxy - Restrict network access — Limit port access by IP if possible
- Monitor logs — Watch for authentication failures and connection issues
See SECURITY.md for detailed security guidelines.
netstat -tulpn | grep :587
telnet smtp.example.com 587- Verify the API key is correct
- Check
SMTP_AUTH_USERNAMEmatches client config - Review server logs:
docker compose logs smtp
- In
nonemode, STARTTLS is disabled (use a reverse proxy instead) - In
manualmode, ensure cert paths are valid:openssl x509 -in /path/to/cert.pem -text
- Verify certificate and key files exist and are readable
- Test the cert:
openssl verify /path/to/cert.pem - Check file permissions:
ls -la /path/to/cert.pem
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Commit changes (
git commit -m 'Add my feature') - Push to the branch (
git push origin feature/my-feature) - Open a Pull Request
See CONTRIBUTING.md for detailed guidelines.
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).
See LICENSE for full details.
In short:
- ✅ Free to use and modify
- ✅ Must share modifications
- ✅ Must include license notice
- ✅ Network use is distribution (modifications must be shared with users)
See CHANGELOG.md for version history and release notes.
- 📖 Documentation: ByteSend Self-Hosting Guide
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
- 📧 Email: support@bytesend.cloud
Built with:
- smtp-server — SMTP server implementation
- mailparser — Email parsing
- Node.js & the open source community
Made with ❤️ by NodeByte Hosting