Skip to content

Secure Email Bridge for Discord - Forward emails to Discord channels via webhooks. Features POP3 fetching, domain filtering, SMTP replies, and stability-focused design.

License

Notifications You must be signed in to change notification settings

ibrahimq21/ravenclaw

Ravenclaw πŸ“¬

Secure Email Bridge for Discord β€” Forward POP3 Emails to Discord Webhooks

GitHub stars GitHub license Python Discord

Ravenclaw is an open-source email-to-Discord bridge that connects your inbox to messaging platforms. Forward emails from any POP3 server to Discord channels via webhooks with zero latency. Features domain filtering, SMTP replies, auto-respond, and production-ready stability.

Keywords: email bridge, discord webhook, pop3 email, smtp, email notification, email forwarder, discord bot, python automation, self-hosted, email alerts, discord notifications


Openclaw Skill Repository

https://github.com/ibrahimq21/openclaw-skill-ravenclaw.git


What Ravenclaw Does

πŸ“§ Email (POP3/SMTP) β†’ πŸ“¬ Ravenclaw β†’ πŸ’¬ Discord (Webhook)

Receive email notifications directly in your Discord server. Perfect for:

  • πŸ“¬ Support tickets β€” Get notified of new emails instantly
  • πŸ”” Alerts β€” Server notifications, monitoring alerts
  • πŸ“‹ Automation β€” Trigger workflows from email content
  • 🏒 Teams β€” Share emails across departments without sharing accounts

Logo

Ravenclaw Logo

Why Ravenclaw?

Feature Ravenclaw Zapier IFTTT Custom Solutions
Cost Free (self-hosted) $50+/mo Free tier limited Dev time
Privacy βœ… Your data stays local ❌ Cloud ❌ Cloud βœ… Controlled
Customization Full Python access Limited Limited Complete
Setup Time 5 minutes 10 minutes 10 minutes Hours/Days
Discord Native βœ… Webhook built-in Integration needed Integration needed Custom dev

Use Cases

  • πŸ“§ Email to Discord β€” Forward emails to channels automatically
  • πŸ”” Server Alerts β€” Get notified of system issues in real-time
  • πŸ“¬ Support Tickets β€” Route support emails to Discord channels
  • πŸ€– Automation β€” Trigger Discord actions from email content
  • πŸ“Š Monitoring β€” Connect email-based alerts to team chat

Features

  • πŸ“₯ POP3 Email Fetching β€” Securely fetch emails from any POP3 server
  • πŸ”’ Domain Filtering β€” Whitelist allowed domains for security
  • πŸ’¬ Discord Integration β€” Forward emails to Discord channels via webhooks
  • πŸ“€ SMTP Replies β€” Send email replies directly from Discord
  • ⏰ Scheduled Checks β€” Configurable polling interval (default: 30 min)
  • πŸ“ JSON Storage β€” All emails stored in readable JSON format
  • πŸ€– Auto-Reply β€” Automatic acknowledgment responses
  • πŸ›‘οΈ Stability β€” Memory leak prevention, log rotation, graceful shutdown
  • ⏰ Scheduled Emails β€” Schedule emails to be sent at specific times via JSON queue
  • πŸ“‹ Scheduled Email Templates β€” example-schedule.json provides templates for scheduling emails


Quick Start (5 Minutes)

# 1. Clone and enter directory
git clone https://github.com/ibrahimq21/ravenclaw.git
cd ravenclaw

# 2. Install dependencies
pip install -r requirements.txt

# 3. Configure environment
cp .env.example .env
# Edit .env with your email and Discord webhook

# 4. Run the bridge
python ravenclaw.py

# 5. Test with curl
curl http://localhost:5002/health

That's it! Emails will now forward to your Discord channel.


Configuration

Create a .env file:

# Email Settings
EMAIL_HOST=mail.yourdomain.com
EMAIL_POP_PORT=995
EMAIL_SMTP_PORT=587
EMAIL_USERNAME=your@email.com
EMAIL_PASSWORD=yourpassword

# Security
DOMAIN_FILTER=example.com,allowed-domain.com

# Discord Webhook
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...

# Bridge Settings
BRIDGE_HOST=0.0.0.0
BRIDGE_PORT=5002
BRIDGE_POLL_INTERVAL=30

Scheduled Emails

Schedule emails to be sent at specific times using the API or JSON queue.

Quick Schedule via API

curl -X POST http://localhost:5002/schedule \
  -H "Content-Type: application/json" \
  -d '{
    "to": "recipient@domain.com",
    "subject": "Leave Request",
    "body": "Dear Manager,\n\nI would like to request leave...",
    "target_time": "2026-02-20T09:00:00",
    "priority": "high"
  }'

Using JSON Queue

Copy example-schedule.json to ravenclaw_scheduled.json and add your emails:

cp example-schedule.json ravenclaw_scheduled.json
# Edit ravenclaw_scheduled.json with your email content

Scheduled Email Schema

{
  "version": "1.0",
  "emails": [
    {
      "id": "unique_id",
      "to": "recipient@domain.com",
      "subject": "Email subject",
      "body": "Email body content",
      "target_time": "2026-12-31T09:00:00",
      "created_at": "auto-generated",
      "status": "pending|sent|failed|cancelled",
      "attempts": 0,
      "priority": "normal|high|low"
    }
  ]
}

Note: ravenclaw_scheduled.json stores your actual scheduled emails. Use example-schedule.json as a template.


API Endpoints

Endpoint Method Description
/ GET Bridge status
/health GET Health check with stats
/inbox GET Get all emails
/inbox/<id> GET Get specific email
/unread GET Get unread emails
/send POST Send email reply
/check POST Trigger manual email check
/stats GET Processing statistics
/mark-read/<id> POST Mark email as read
/schedule POST Schedule an email to be sent later
/schedule/list GET List all scheduled emails
/schedule/cancel/<id> POST Cancel a scheduled email
/check-scheduled POST Trigger manual scheduled email check

Stability & Memory Management

Ravenclaw includes enterprise-grade stability features:

  • Inbox Limits β€” Maximum 1000 emails stored (prevents JSON bloat)
  • Log Rotation β€” 1MB log files with 5 backups (prevents disk full)
  • State Trimming β€” Sync state limited to 500 msg IDs
  • Graceful Shutdown β€” SIGINT/SIGTERM handlers for clean exit
  • In-Memory Caching β€” State cached in sync watcher (reduces I/O)

Roadmap 🎯

Phase 1 β€” Current

  • βœ… Discord Webhooks
  • βœ… Discord Bot Integration
  • βœ… JSON File Watcher
  • βœ… Stability & Memory Management

Phase 2 β€” Community Contributions Welcome

  • πŸ“Œ Slack β€” Channel and user notifications via Bot Token
  • πŸ“Œ Telegram β€” Bot API integration for private and group chats
  • πŸ“Œ WhatsApp β€” Twilio or Baileys integration
  • πŸ“Œ Matrix β€” Synapse bot support
  • πŸ“Œ Email Rules β€” Filter, label, and forward based on content

Phase 3 β€” Advanced

  • πŸ“‹ Multiple Accounts β€” Support for multiple email/Discord pairs
  • πŸ“‹ Plugins β€” Plugin architecture for custom integrations
  • πŸ“‹ Web UI β€” Dashboard for managing connections

Contributing

We welcome contributions! Here's how you can help:

Adding a New Channel (e.g., Slack)

  1. Create a new file: ravenclaw_channels/slack.py
  2. Implement the channel interface:
def send_message(sender, subject, body, msg_id):
    """Send email content to Slack"""
    # Your implementation
    pass
  1. Add to ravenclaw.py channel registry:
from ravenclaw_channels import slack, telegram

CHANNELS = {
    'discord': discord.send_message,
    'slack': slack.send_message,
    'telegram': telegram.send_message,
}
  1. Submit a PR!

Other Contributions

  • Bug fixes and improvements
  • Documentation enhancements
  • Security audits
  • Test coverage

Architecture

Email Server (POP3)
       ↓
  Ravenclaw Bridge
       ↓
β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”
β”‚   Channels  β”‚  ← Extensible plugin system
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       ↓
Discord / Slack / Telegram / WhatsApp / ...

License

MIT License β€” Feel free to use, modify, and distribute.


Maintainers:


Built for secure, flexible email bridging. Make it yours.

About

Secure Email Bridge for Discord - Forward emails to Discord channels via webhooks. Features POP3 fetching, domain filtering, SMTP replies, and stability-focused design.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published