#
Nostr Mail Bridge
A bidirectional bridge between legacy email systems and the Nostr protocol.
#
Architecture
INBOUND (Email → Nostr)
┌─────────────┐ ┌─────────────────┐ ┌────────┐ ┌──────┐
│ Legacy Email│ ───► │ inbound-smtp │ ───► │ Relays │ ───► │ User │
└─────────────┘ │ or │ └────────┘ └──────┘
│ inbound-mailgun │
└─────────────────┘
OUTBOUND (Nostr → Email)
┌──────┐ ┌────────┐ ┌────────┐ ┌─────────────┐
│ User │ ───► │ Relays │ ───► │ bridge │ ───► │ Legacy Email│
└──────┘ └────────┘ └────────┘ └─────────────┘
DISCOVERY
┌────────┐ GET /.well-known/nostr.json ┌───────────────┐
│ Client │ ──────────────────────────────────► │ nip05-service │
└────────┘ └───────────────┘
#
Components
#
Quick Navigation
Email → Nostr: SMTP server or Mailgun webhooks
Nostr → Email: Subscribe to events and send via SMTP
Extensible plugin system for filtering
Environment variables and settings
#
Quick Start with Docker
git clone https://github.com/nogringo/nostr-mail-bridge
cd nostr-mail-bridge
cp .env.example .env
docker-compose up -d
#
Services Overview
#
Inbound Service
Handles incoming emails from legacy systems:
- SMTP Mode: Runs an SMTP server to receive emails directly
- Mailgun Mode: Receives webhooks from Mailgun
#
Outbound Service
Handles outgoing emails to legacy systems:
- Subscribes to gift-wrapped events (kind 1059)
- Unwraps NIP-59 encrypted emails
- Sends via SMTP or Mailgun API
#
NIP-05 Service
Provides user discovery via .well-known/nostr.json:
GET /.well-known/nostr.json?name=alice
{
"names": {
"alice": "<pubkey_hex>"
}
}
#
Self-Hosted Setup
For a fully self-hosted setup without external services:
┌──────────────────────────────────────────────────┐
│ Your Server │
│ │
│ ┌──────────────┐ ┌────────┐ ┌──────────────┐ │
│ │ inbound-smtp │ │ bridge │ │ nip05-service│ │
│ │ :25 │ │ │ │ :3000 │ │
│ └──────────────┘ └────────┘ └──────────────┘ │
│ │ │ │ │
│ └──────────────┼──────────────┘ │
│ │ │
│ ┌────────┐ │
│ │ Postfix│ (or any MTA) │
│ └────────┘ │
└──────────────────────────────────────────────────┘
Required DNS configuration:
- MX record pointing to your server
- A/AAAA record for your mail domain