Sign inSign up

realgeneraliroh/mailcord

By realgeneraliroh

•Updated almost 2 years ago

Simple email to discord python bridge.

Image
Integration & delivery
1

235

realgeneraliroh/mailcord repository overview

⁠Mailcord

GitHub Repository: github.com/real-general-iroh/mailcord⁠

Mailcord is a lightweight Python application designed to forward emails from your IMAP inbox to Discord as rich embeds. It integrates seamlessly with services like Cloudflare Email Routing and is configurable via environment variables, making it easy to deploy with Docker or Docker Compose.

⁠Features

  • Fetches unseen emails from any IMAP-compatible server (e.g., Gmail).
  • Forwards emails as Discord embeds to specific users or a default catch-all user.
  • Supports logging with adjustable verbosity (ERROR, WARNING, INFO, DEBUG, VERBOSE).
  • Configurable polling interval for checking new emails.
  • Optional integration with Cloudflare Email Routing for custom domain support.
  • Flexible user mapping to route specific email addresses to Discord IDs.

⁠Images

Example Short Email Embed

Example Long Email Embed With Two Parts

⁠Requirements

  • An IMAP-compatible email account (e.g., Gmail).
  • A Discord bot token.
  • Docker or Docker Compose for deployment.

⁠Environment Variables

VariableDescriptionRequiredDefault
IMAP_SERVERIMAP server address (e.g., imap.gmail.com).Yes
IMAP_USERIMAP username/email.Yes
IMAP_PASSIMAP password or app-specific password.Yes
DISCORD_BOT_TOKENDiscord bot token.Yes
MAINTAINER_IDDiscord user ID for troubleshooting notes.Yes
CATCH_ALL_USER_IDDefault Discord user ID for unmatched emails.NoMAINTAINER_ID
USER_MAP_*Maps email addresses to Discord IDs (USER_MAP_user=email:discord_id).No
LOG_LEVELLogging verbosity (ERROR, WARNING, INFO, DEBUG, VERBOSE).NoINFO
POLL_INTERVALInterval (in seconds) to poll for new emails.No60
⁠Example .env File
IMAP_SERVER=imap.gmail.com
[email protected]
IMAP_PASS=your-app-password
DISCORD_BOT_TOKEN=12345678901234567890
MAINTAINER_ID=12345678901234567890
CATCH_ALL_USER_ID=12345678901234567890
[email protected]:12345678901234567890
LOG_LEVEL=INFO
POLL_INTERVAL=60

⁠Deployment

⁠Docker Compose
services:
    mailcord:
        restart: unless-stopped
        image: realgeneraliroh/mailcord:latest
        container_name: mailcord
        environment:
            - POLL_INTERVAL=60
            - IMAP_SERVER=imap.gmail.com
            - [email protected]
            - IMAP_PASS=your-app-password
            - DISCORD_BOT_TOKEN=12345678901234567890
            - MAINTAINER_ID=12345678901234567890
            - CATCH_ALL_USER_ID=12345678901234567890
            - LOG_LEVEL=INFO
            - [email protected]:12345678901234567890

Run:

docker-compose up -d
⁠Direct Docker Run
docker run -d --env-file .env realgeneraliroh/mailcord:latest

⁠Known Limitations

  1. Email Formatting: Poorly formatted emails will render poorly in embeds. This is why MAINTAINER_ID is required for troubleshooting notes in embeds.
  2. Polling, Not Push: Relies on IMAP polling because IMAP doesn't support real-time push notifications.

Tag summary

Content type

Image

Digest

sha256:d62ed8480…

Size

45.4 MB

Last updated

almost 2 years ago

docker pull realgeneraliroh/mailcord