Skip to content
Simple smtp email server which redirects emails to slack.
Python Standard ML Dockerfile
Branch: master
Clone or download
Pull request Compare This branch is 16 commits ahead, 9 commits behind ont:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
etc/slacker
.dockerignore
.drone.yml
.drone.yml.sig
.gitignore
Dockerfile
LICENSE
README.md
dummy_email.txt
handler.py
requirements.txt
test_handler.py

README.md

Slacker

Slacker is simple email-to-slack gateway. It support basic rules for routing messages to different slack channels from different bots.

Main purpose of slacker is to redirect messages from old-school systems which doesn't support messaging other than email. For example cron and monit (https://mmonit.com/monit/) support only emails as the only system for notifications.

Installation

Slacker can be easily built and run via docker:

docker build .

Config

Slacker supports simple list of rules for configuring target slack channel, bot name and its avatar depending on email content.

There are two sections:

  • default: this is default options for sending message to slack.
  • rules: list of rules for matching email message against 'from', 'to' and/or 'subject'.

Each rule in list tested in order. First matched rule is used to update options values from 'default' section of config.

Example config.yml for redirecting email to two channels: #monit and #cron:

# default values for channel, bot name, avatar url, slack token and debug mode
default:
    channel: '#general'
    username: slacker
    icon_url: ''
    slack_token: xoxb-00000000000-aaaaaaaaaaaaaaaaaaaaaaaa
    debug: false


# list of rules
rules:
    - name: Monit rule
      from: monit@.*     # all emails from monit@localhost will match this rule

      options:
          username: monit
          channel: '#monit'
          icon_url: 'https://bitbucket.org/tildeslash/monit/avatar/128'
          debug: false


    - name: Cron rule
      from: root@localhost
      subject: Cron.*    # cron email subject starts with "Cron..."

      options:
          username: cron
          channel: '#cron'
          icon_url: ''
          debug: true    # will output full email with all X-headers
You can’t perform that action at this time.