A SMTP mail to Slack Channel open relay.
69
Small Docker image with a simple Python script to relay internal SMTP to a Slack Channel.
This is an OPEN RELAY meant to run on a LAN. This will accept any port 25 SMTP mail unauthenticated. It is meant to be placed in a DMZ or behind a firewall.
.env file
# NOTE: this file is loaded via docker-compose's env_file:, which does NOT
# strip quotes the way a shell would. Do not quote values below.
# Slack App Bot User OAuth token (needs chat:write scope; bot must be a
# member of every channel referenced in docker-compose.yml's SLACK_ROUTES)
SLACK_OAUTH_TOKEN=xoxb-your-token-here
compose.yaml
services:
smtp-to-slack-relay:
image: dpcox/smtp-to-slack-relay:latest
container_name: smtp-to-slack-relay
restart: unless-stopped
ports:
- "2525:2525"
cap_add:
- NET_BIND_SERVICE
user: "1000:1000" # optional, run as non-root
env_file:
- .env # SLACK_OAUTH_TOKEN only — keep secrets out of this file
environment:
LISTEN_HOST: 0.0.0.0
LISTEN_PORT: 2525
# Optional catch-all channel for unmapped recipients. Leave unset (empty
# string, or delete the line) to require every sending app's recipient
# address to have an explicit route below.
SLACK_DEFAULT_CHANNEL: CHANNEL_ID_HERE
# Recipient address -> route. Each route is an object with a required
# "channel" and optional "username"/"icon_emoji" override (needs the
# chat:write.customize Slack scope). Any envelope recipient not listed
# here falls back to SLACK_DEFAULT_CHANNEL if set, otherwise the
# message is rejected with a 550.
SLACK_ROUTES: |
{
"[email protected]": {
"channel": "CHANNEL_ID",
"username": "LibreNMS",
"icon_emoji": ":rotating_light:"
},
"[email protected]": {
"channel": "CHANNEL_ID"
}
}
Content type
Image
Digest
sha256:14fbf7258…
Size
45.6 MB
Last updated
about 1 month ago
docker pull dpcox/smtp-to-slack-relay