SMTP server to forward messages to shoutrrr endpoints
- Go 85.7%
- Makefile 13.4%
- Dockerfile 0.9%
The Body() method now correctly handles: - Plain text/plain and text/html emails (not just multipart) - All multipart types (mixed, related, etc., not just alternative) - Falls back to HTML if text/plain is not available - Adds debug logging for body length and content type Additionally, when sending to multiple targets, query parameters are now merged instead of replaced, preserving service-specific parameters like Mattermost's username, icon, and channel configuration. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| .woodpecker | ||
| cmd | ||
| .gitignore | ||
| .goreleaser.yml | ||
| backend.go | ||
| backend_test.go | ||
| config.go | ||
| Containerfile | ||
| email.go | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| server.go | ||
smtp2Shoutrrr
A simple SMTP server that forwards incoming emails to a Shoutrrr supported service.
Installing
First generate a new configuration file following this example:
# config.toml
# Port the SMTP server will listen on
Port = 11025
# Credentials for the SMTP server (default to username/password if not set/empty)
Username = "user"
Password = "nometokens"
# Configure recipients to forward emails to
# Multiple Targets (Recommended)
# Use the Targets array to send notifications to multiple services
[[Recipients]]
# Email addresses to forward emails from
Addresses = ["user@example.com"]
# Shoutrrr services to forward emails to
# See shoutrrr documentation: https://containrrr.dev/shoutrrr/
Targets = [
"ntfy://ntfy.sh/my-ntfy-topic?tags=email",
"discord://token@id",
"slack://token@channel"
]
# Single Target (Deprecated)
# The Target field is still supported for backward compatibility
[[Recipients]]
Addresses = ["legacy@example.com"]
Target = "ntfy://ntfy.sh/legacy-topic?tags=thing" # Will show deprecation warning
# Note: Repeat [[Recipients]] as needed
# Optional: Configure a catch-all recipient for unmatched email addresses
[CatchAll]
# Shoutrrr services to forward unmatched emails to
Targets = ["ntfy://ntfy.sh/catch-all-topic?tags=unmatched"]
From releases
- Grab the latest release from the releases page
- Put the configuration file in the same directory as the binary
- Run the binary for your appropriate platform
From source (development)
- Clone this repository
- Put the configuration file in the repository folder
- Run
make quick-run
Using docker
- Create a
config.tomlfile as described above - Run the docker image mounting the
Config.tomlfile as/config.tomland exposing the configured port:
docker run -v /path/to/config.toml:/config.toml \
-p 11025:11025 \
git.nakama.town/fmartingr/smtp2shoutrrr:latest
Development
Run the server with:
make quick-run
Send a test email with:
This will read the
config.tomlin the current directory to set the appropriate SMTP client configuration.
go run ./cmd/sendmail/.