DEV Community

Cover image for Setup Your Own Email-to-Webhook Gateway in Go
Johan
Johan

Posted on • Edited on

Setup Your Own Email-to-Webhook Gateway in Go

I just open-sourced SMTPHook — a self-hosted email ingestion service written in Go. If you've ever wanted to turn incoming emails into structured webhook events (e.g. to ping a pager, log alerts, trigger bots, etc.), this tool is for you. If it works for you consider sponsor me with a coffee https://buymeacoffee.com/voidwatch


What It Does

SMTPHook is a modular platform that:

✅ Accepts SMTP emails via Mailpit

✅ Parses raw emails into structured JSON

✅ Forwards the payload to your webhook endpoint

✅ Includes retry logic, logging, health checks

✅ Supports full local testing with swaks


Example Use Cases

  • Alerting: Email → Webhook → PagerDuty / Discord / Slack
  • Archiving: Email → JSON → S3 / DB / Elasticsearch
  • Automation: Email triggers CI/CD, bots, or workflows
  • Dev Testing: No need to poll real mailboxes anymore

⚡ Quick Start

git clone git@github.com:voidwatch/SMTPHook-Golang.git
cd SMTPHook-Golang
chmod +x setup-parser.sh
./setup-parser.sh
Enter fullscreen mode Exit fullscreen mode

Then send a test email (if you set up the test env with setup.sh:

swaks --to test@example.com --server localhost:1025 < email.txt
Enter fullscreen mode Exit fullscreen mode

And receive it on your webhook.


🛠 Technologies Used

  • Go (all components)
  • Mailpit for dev SMTP
  • Podman + Compose
  • A dash of Curl and a bit of swaks

🔗 GitHub

📡 Check out SMTPHook on GitHub →

I’d love your feedback, contributions, or ideas. If you find this useful and want to support the project, stars or donations are always welcome!


🙏 Support & Contributions

If you're an indie devops engineer, or just love hacking with Go and automation, I’d love your thoughts.

DM me or check the repo for sponsor links.
https://buymeacoffee.com/voidwatch

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.