Giter Club home page Giter Club logo

discord-smtp-relay's Introduction

Discord SMTP Relay

This project is a very simple relay from SMTP to a Discord webhook. This allows applications that only support SMTP email notifications to be routed to Discord without an actual email server as a middle-man.

This is currently a work-in-progress. At the moment, it supports a few options for authentication:

  • No authenticaion, no TLS
  • PLAIN or LOGON authentication, without TLS
  • PLAIN or LOGON authentication with TLS

It currently only allows one username/password combination, which are set by environment variables (see below). If you don't need authentication or TLS, simply don't set those variables (SMTP_USERNAME/PASSWORD or TLS_CERT/KEY respectively).

This is designed for use internally only, specifically within a Docker network. I would not recommend exposing this to the internet (or any untrusted network) in its current form, especially if not using TLS.

Environment variables

Variable Description Example
WEBHOOK_URL Discord webhook URL. https://discord.com/api/webhooks/xxxxxx/yyyyyy
SMTP_USERNAME Accepted username for SMTP testuser
SMTP_PASSWORD Accepted password for SMTP testpass
TLS_CERT_CHAIN File path to full TLS certificate chain fullchain.pem
TLS_KEY File path to private key for certificate privkey.pem

Running

  1. Install the requirements:
pip install -r requirements.txt
  1. Set the environment variables as desired

  2. Run the server:

python discord_relay.py

discord-smtp-relay's People

Contributors

hamiltlr avatar

Stargazers

Ryan K. Smith avatar

Watchers

 avatar Ryan K. Smith avatar

Forkers

psyciknz

discord-smtp-relay's Issues

Support authentication

Should support authentication:

  • Set username/password via environment variables SMTP_USERNAME, SMTP_PASSWORD
    • This would force any clients to authenticate with that username/password
    • Could also use username/password to provide the Discord webhook info, which would allow each app to send to a different webhook
  • May need to support SSL/TLS, could pass cert/key via environment variables

"There is no current event loop"

First, this is EXACTLY what I've been looking for.

I'm getting an error when launching the script. It outputs the following

DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()

I'm running Python 3.10, not using docker.

Anyone interested in attachments?

Wondering, how hard it would be to add those.....I've not looked into the aiosmtpd.smtp library much, but I think I would be mucking around in the handle_message method, as far as I can tell that's where it deals with teh incoming message and them posts to discord.

So I'd need some sort of way of figuring out if the body is multipart and contains an image...and if so change the call to discord to include an image.

Session.login_data is deprecated warning

Need to investigate this warning:
Session.login_data is deprecated and will be removed in version 2.0

I'm not using login_data anywhere, so I think something is calling that under the covers. I need to do some more investigation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.