Skip to content

afterdarksys/aftermail

Repository files navigation

πŸ“§ AfterMail

Next-Generation Email Platform - Supporting traditional protocols AND cutting-edge Web3/blockchain-backed messaging.

What is AfterMail?

AfterMail is a comprehensive email platform that bridges traditional email (IMAP, Gmail, Outlook) with next-generation protocols (AfterSMTP, Mailblocks). It's both a protocol debugging tool AND a full-featured email client with first-class support for encrypted, blockchain-verified messaging.

The Strategy

Most Web3 projects fail because they require users to abandon existing systems. AfterMail takes a different approach:

  1. Download for traditional email - Works perfectly with Gmail, Outlook, any IMAP server
  2. Discover advanced features - Built-in migration wizard, protocol testing, security verification
  3. Graduate to Web3 - When ready, use AfterSMTP/Mailblocks for encrypted DID-based messaging
  4. Keep both - Traditional and Web3 email coexist in one unified interface

This gives AfterSMTP and Mailblocks a real product with actual users, not just a token and whitepaper.

Features

Traditional Email Support

  • IMAP/POP3/SMTP - Standard email protocols
  • Gmail Integration - OAuth2 authentication, Gmail API support
  • Outlook Integration - Microsoft Graph API for Outlook.com and Microsoft 365
  • Folder Management - Inbox, Sent, Trash, custom folders
  • Attachments - Full support for file attachments

AfterSMTP Advanced Message Protocol (AMP)

  • DID-Based Identity - No more passwords! did:aftersmtp:msgs.global:username
  • End-to-End Encryption - X25519 + AES-GCM-256 encryption
  • Cryptographic Signatures - Ed25519 signatures, blockchain-backed verification
  • Modern Message Format (AMF) - Replaces legacy MIME with clean Protobuf structure
  • Proof of Transit - Every message recorded on Substrate blockchain
  • QUIC Transport - 0-RTT latency, faster than traditional SMTP
  • msgs.global Client - Connect to the free public AfterSMTP gateway

Mailblocks Web3 Email

  • Proof-of-Stake Spam Prevention - Senders stake ETH to reach your inbox
  • IPFS Storage - Distributed message storage
  • Quarantine System - Review staked emails before accepting
  • Wallet Integration - Ethereum wallet support

Protocol Testing & Debugging

  • Grammar Testing - SMTP, IMAP, POP3 compliance checks
  • Security Verification - SPF, DKIM, DMARC, MTA-STS, BIMI, ARC
  • Raw Session Debugging - Interactive protocol sessions
  • Message Inspector - Parse and analyze both MIME and AMF messages
  • AfterSMTP Gateway Testing - gRPC connection testing, DID verification

Migration Tools

  • Migration Wizard - Step-by-step guide to migrate from Gmail/Outlook to AfterSMTP
  • Bulk Import - Import thousands of messages preserving metadata
  • Format Conversion - Automatic MIME β†’ AMF conversion
  • Contact Migration - (Coming soon)

Architecture

Message Formats

MIME (Traditional):

From: sender@example.com
To: recipient@example.com
Subject: Hello
Content-Type: text/plain

Message body here

AMF (AfterSMTP):

message AMFPayload {
    string subject = 1;
    string text_body = 2;
    string html_body = 3;
    repeated Attachment attachments = 4;
    map<string, string> extended_headers = 5;
}

Benefits of AMF over MIME:

  • βœ… Native binary format (no base64 overhead)
  • βœ… Structured data (no complex parsing)
  • βœ… Hash verification for attachments
  • βœ… Clean separation of headers and body
  • βœ… Extensible with custom headers

Account Types

AfterMail supports 7 account types:

Type Protocol Authentication Use Case
IMAP IMAP/SMTP Username/Password Traditional mail servers
POP3 POP3/SMTP Username/Password Legacy systems
Gmail Gmail API OAuth2 Google Workspace
Outlook Graph API OAuth2 Microsoft 365
msgs.global AfterSMTP/gRPC DID + Ed25519 Free encrypted email
AfterSMTP AfterSMTP/gRPC DID + Ed25519 Self-hosted gateway
Mailblocks Web3 + IPFS Ethereum Wallet PoS email

Installation

# Clone the repository
git clone https://github.com/afterdarksys/aftermail
cd aftermail

# Install dependencies
go mod tidy

# Build
go build -o aftermail

# Run GUI
./aftermail

# Or use CLI commands
./aftermail test smtp --host mail.example.com --port 25
./aftermail verify example.com
./aftermail amp send --target did:aftersmtp:msgs.global:alice --payload "Hello!"

Configuration

Setting up Gmail

  1. Go to Google Cloud Console
  2. Create OAuth2 credentials
  3. Add to AfterMail: Tools β†’ Manage Accounts β†’ Add Gmail Account
  4. Authenticate via OAuth

Setting up AfterSMTP

  1. Get a DID identity:

    • Use Migration Wizard (Tools β†’ Migration Wizard)
    • Or CLI: ./aftermail register --username yourname
  2. Keys are automatically generated:

    • Ed25519 signing key
    • X25519 encryption key
  3. Connect to msgs.global or self-hosted gateway

Setting up Mailblocks

  1. Connect Ethereum wallet
  2. Configure IPFS endpoint
  3. Set quarantine stake threshold

Usage Examples

Send Traditional Email

# Via CLI
./aftermail send --to user@example.com --subject "Hello" --body "Test message"

# Via GUI
Composer β†’ Select IMAP account β†’ Write message β†’ Send

Send AfterSMTP Encrypted Message

# Via CLI
./aftermail amp send \
  --did did:aftersmtp:msgs.global:ryan \
  --target did:aftersmtp:msgs.global:alice \
  --payload "Encrypted message"

# Via GUI
Composer β†’ Select AfterSMTP account β†’ Enter DID β†’ Write message β†’ Send

Migrate from Gmail

# Via GUI: Tools β†’ Migration Wizard
1. Authenticate with Gmail
2. Create/select AfterSMTP DID
3. Select folders to migrate
4. Run migration (converts MIME β†’ AMF automatically)

Inspect Message Format

# Via GUI: Protocol Inspector β†’ Inspect Message
# Paste MIME or AMF hex β†’ Auto-detects format β†’ Shows parsed structure

Protocol Comparison

Feature SMTP/MIME AfterSMTP/AMF Mailblocks
Encryption TLS only (transport) E2E (X25519+AES) E2E + IPFS
Signatures DKIM (optional) Ed25519 (required) Blockchain
Identity Email address DID (blockchain) Ethereum address
Spam Prevention Filters DID reputation Proof-of-stake
Format Text (MIME) Protobuf (AMF) Protobuf + IPFS
Storage Centralized Gateway-based IPFS
Proof of Delivery Bounce messages Blockchain receipt Smart contract

Development

Project Structure

aftermail/
β”œβ”€β”€ cmd/                    # CLI commands
β”‚   β”œβ”€β”€ root.go            # Main command
β”‚   β”œβ”€β”€ test.go            # Protocol testing
β”‚   β”œβ”€β”€ verify.go          # Security verification
β”‚   β”œβ”€β”€ amp.go             # AfterSMTP commands
β”‚   └── web3.go            # Mailblocks commands
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ gui/               # Fyne GUI components
β”‚   β”‚   β”œβ”€β”€ gui.go         # Main window
β”‚   β”‚   β”œβ”€β”€ composer.go    # Email composer
β”‚   β”‚   β”œβ”€β”€ folders.go     # Folder/inbox view
β”‚   β”‚   β”œβ”€β”€ amfviewer.go   # AMF message viewer
β”‚   β”‚   β”œβ”€β”€ migration.go   # Migration wizard
β”‚   β”‚   └── protocol.go    # Protocol inspector
β”‚   └── daemonapi/         # Background daemon
└── pkg/
    β”œβ”€β”€ accounts/          # Account management
    β”‚   β”œβ”€β”€ types.go       # Account/Message types
    β”‚   β”œβ”€β”€ gmail.go       # Gmail OAuth client
    β”‚   β”œβ”€β”€ outlook.go     # Outlook Graph client
    β”‚   └── msgsglobal.go  # AfterSMTP client
    β”œβ”€β”€ amp/               # AfterSMTP client library
    β”œβ”€β”€ web3mail/          # Mailblocks client library
    β”œβ”€β”€ security/          # SPF/DKIM/DMARC verification
    β”œβ”€β”€ smtp/              # SMTP testing
    β”œβ”€β”€ imap/              # IMAP testing
    └── pop3/              # POP3 testing

Building from Source

# Install Go 1.21+
go version

# Install dependencies
go mod download

# Build for your platform
go build -o aftermail

# Build for all platforms
GOOS=windows GOARCH=amd64 go build -o aftermail.exe
GOOS=darwin GOARCH=amd64 go build -o aftermail-mac
GOOS=linux GOARCH=amd64 go build -o aftermail-linux

Roadmap

v1.0 (Current)

  • βœ… Traditional IMAP/POP3/SMTP support
  • βœ… Gmail OAuth integration
  • βœ… Outlook Graph API integration
  • βœ… AfterSMTP AMP client (msgs.global)
  • βœ… Mailblocks Web3 client
  • βœ… Migration wizard
  • βœ… Protocol testing tools
  • βœ… AMF message viewer

v1.1 (Next)

  • ⬜ Contact management and migration
  • ⬜ Attachment encryption for AMF
  • ⬜ Calendar integration
  • ⬜ Push notifications
  • ⬜ Mobile apps (React Native with AMP support)

v2.0 (Future)

  • ⬜ Full HTML email rendering
  • ⬜ PGP compatibility layer
  • ⬜ Multi-signature workflows
  • ⬜ Smart contract triggered emails
  • ⬜ Decentralized group messaging

Contributing

We welcome contributions! This project bridges traditional email and Web3 - opportunities exist in:

  • Protocol implementations
  • UI/UX improvements
  • Security audits
  • Documentation
  • Testing
  • Client libraries for other languages

Security

Responsible Disclosure

Report security vulnerabilities to: security@aftermail.dev

Cryptography

  • Ed25519 - Message signatures (libsodium)
  • X25519 - Key exchange (libsodium)
  • AES-GCM-256 - Payload encryption
  • TLS 1.3 - Transport security
  • DANE - Certificate pinning

Key Storage

Private keys are stored encrypted at rest using OS keychain:

  • macOS: Keychain Access
  • Windows: DPAPI
  • Linux: Secret Service API

License

MIT License - See LICENSE file

Credits

Built with:


Next-Generation Email Platform πŸ“§

For support, visit: https://aftermail.dev

About

🐱 Making email purr again - Next-gen email client supporting traditional protocols (Gmail, Outlook, IMAP) and Web3 (AfterSMTP, Mailblocks)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors