https://github.com/leonardinius/smtpd-proxy
https://github.com/leonardinius/smtpd-proxy
smtp smtp-relay smtp-relay-server smtp-server
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/leonardinius/smtpd-proxy
- Owner: leonardinius
- License: mit
- Created: 2022-08-14T01:07:39.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-22T23:19:54.000Z (about 1 year ago)
- Last Synced: 2025-04-22T23:33:53.935Z (about 1 year ago)
- Topics: smtp, smtp-relay, smtp-relay-server, smtp-server
- Language: Go
- Homepage:
- Size: 743 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# smtpd-proxy
## What it is?
SMTPd-Proxy is a proxy (relay), to load balance multiple SMTP upstream servers.

**Motivation**
- E-mails and e-spam is sensitive topic. In my day-job we get our email accounts constantly suspended for days, and communicate with support to unblock.
- The other tool we rely to supports 1 SMTP server at a time.
- To tinker with Golang with something reasonably simple and non-trivial.
This is my first non-trivial Golang project and no doubt I have been wrongful, non idiomatic and plain stupid somewhere in the codebase. That said,
- you are free to not use this tool,
- you are kindly welcome to submit Contributions and provide helpful feedback to improve the code base or tool.
## Installation
Grab latest release from https://github.com/leonardinius/smtpd-proxy/releases/latest or build from source.
**Assets**
- [smtpd-proxy-darwin-amd64](https://github.com/leonardinius/smtpd-proxy/releases/latest/download/smtpd-proxy-darwin-amd64)
- [smtpd-proxy-darwin-arm64](https://github.com/leonardinius/smtpd-proxy/releases/latest/download/smtpd-proxy-darwin-arm64)
- [smtpd-proxy-linux-amd64](https://github.com/leonardinius/smtpd-proxy/releases/latest/download/smtpd-proxy-linux-amd64)
- [smtpd-proxy-linux-arm64](https://github.com/leonardinius/smtpd-proxy/releases/latest/download/smtpd-proxy-linux-arm64)
- [smtpd-proxy-windows-amd64.exe](https://github.com/leonardinius/smtpd-proxy/releases/latest/download/smtpd-proxy-windows-amd64.exe)
- [smtpd-proxy-windows-arm64.exe](https://github.com/leonardinius/smtpd-proxy/releases/latest/download/smtpd-proxy-windows-arm64.exe)
- [smtpd-proxy.yml](https://github.com/leonardinius/smtpd-proxy/releases/latest/download/smtpd-proxy.yml)
To build from source, make sure you have GNU make available.
```shell
$ make all
```
## Run & Configure
How-to run
```
./bin/smtpd-proxy --help
Usage:
smtpd-proxy [OPTIONS]
Application Options:
-c, --configuration= smtpd-proxy.yml configuration path (default: smtpd-proxy.yml) [$SMTPD_CONFIG]
-v, --verbose verbose mode [$VERBOSE]
Help Options:
-h, --help Show this help message
smtpd-proxy revision dirty-gitsha1
```
Configuration
```yaml
smtpd-proxy:
# interface address smtpd-proxy will listen-to
# use *:1025 to bind on localhost,
# or 0.0.0.0:1025 to listen on all interfaces
listen: 127.0.0.1:1025
# host identification
ehlo: localhost
# authentication.
username: user
password: secret
# is_anon_auth_allowed: true
# TLS cert and key.
# server-cert: server.crt
# server-key: server.key
upstream-servers:
- type: log
weight: 10
- type: smtp
weight: 10
settings:
# host:port to conect to
addr: smtp.mailtrap.io:2525
# host identification, optional, needed for auth
host: smtp.mailtrap.io
# Auth methods available: login, plain, cram-md5, anon
auth: plain
username: 8333f344d8884e
password: secret
- type: ses
weight: 1000
settings:
# AWS credentials, key ID
aws_access_key_id: amz-key-1
# AWS credentials, access secret key
aws_secret_access_key: amz-**-secret
# AWS API endpoint, e.g. localstack
# endpoint: http://localhost:4566
# region: us-east-1
```
tl;dr
- smtpd-proxy provides SMTP, plain + login auth, TLS (not tested)
- Upstreams: AWS SES, SMTP forward (plain, login, cram-md5), `log` for troubleshooting.
Example:
```shell
./bin/smtpd-proxy
smtpd-proxy revision dirty-gitsha1
2022-09-03T06:13:59.139+0300 info Parsing yaml at path: smtpd-proxy copy.yml
2022-09-03T06:13:59.141+0300 info Starting server at 127.0.0.1:1025 [EHLO localhost]
2022-09-03T06:14:38.272+0300 info log-forwarder {"uid": "uid:53ee46bd42803f97", "From": "from@example.com ", "To": ["Mailtrap Inbox to-30080-1128@example.com