Code Monkey home page Code Monkey logo

slack-email's Introduction

Slack Email

Slack-Email is a standalone server used to integrate email with Slack. The server allows email to be sent to a domain you set up then uploaded to Slack as a plain-text file. Emails can posted into any channel simply by sending to [channel]@mydomain.com. Slack-Email is built on top of Mailin.

Setup

Mailin

The first step is to setup a Mailin server. An Ubuntu server is recommended. The instance does not need to be very powerful, an AWS t2.micro (1GB RAM, 1 CPU) works fine.

Once the server has been created follow the Mailin install instructions to set up Node.js and your DNS. Only follow the Initial setup instructions, we'll run Mailin slightly differently.

Slack-Email

Once the Mailin dependencies have been met we can set up Slack-Email. To begin clone this repo somewhere on the Mailin server. You will run the project from the folder it lives in.

NPM

To update all Node.js dependencies run npm update --save in the Slack-Email folder.

Config

There is an example config file named config.json.example. Copy this file to config.json and edit it accordingly. Descriptions of the config items are below.

  • users - This is an email mapping object used to map multiple email addresses to a single user. Create one key for each user you want recognized and place all email alias' of that user in the array. All emails should be lowercase, Slack-Email lowercases all emails before matching the user.
  • default [Optional] - The default user files get posted as if no matching email address is found. Emails without a matching email address will not be posted if there is no default user.
  • allowedDomains [Optional] - An array of allowed domains. Emails from these domains will be posted if there is a default user specified as the default user.
  • domain - The email domain Slack-Email will look for on the To and CC fields.

API Keys

To use Slack-Email each user needs to obtain a personal API authentication token. Files can only be posted to Slack by people, so bots can't be used. Each user should place their API key under the users/ directory in a file named after their username (e.g. theconnman's API key would go in users/theconnman).

Running

To run Slack-Email navigate to the project directory on your Mailin server and execute nohup node index.js & to run the script in the background. The log file will automatically be logged to nohup in the same directory.

NOTE: Due to an unresolved socket hangup error running the above command will die after a day or two. Please run the included wrapper script with nohub wrapper.sh &.

Usage

Once your instance has been fully configured using Slack-Email is as easy as sending an email to (either explictly in the To field or by CCing) [channel]@mydomain.com where [channel] is any channel you have access to. Slack-Email will parse out the channel name and share the email body as a plain-text file in that channel

License

Slack-Email has been released under the MIT license by SRA International, INC. It was originally developed specifically for the SRA Rapid Application Development Team and early versions contained sensitive information (e.g. email addresses, usernames, domains) which have been sanitized from the Git history. Because of this, it is recommended not to use versions of Slack-Email before v1.0.0.

slack-email's People

Contributors

swb1701 avatar theconnman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

slack-email's Issues

Allowed Email Domain

Create an Allowed Email Domains config which will automatically post emails from those domains using the default user.

Socket Hangup Error

Still getting a Socket Hangup Error after about 2 days.

Error: socket hang up
    at SecurePair.error (tls.js:1013:23)
    at EncryptedStream.CryptoStream._done (tls.js:705:22)
    at CleartextStream.read [as _read] (tls.js:496:24)
    at CleartextStream.Readable.read (_stream_readable.js:320:10)
    at EncryptedStream.onCryptoStreamFinish (tls.js:301:47)
    at EncryptedStream.g (events.js:180:16)
    at EncryptedStream.EventEmitter.emit (events.js:92:17)
    at finishMaybe (_stream_writable.js:356:12)
    at endWritable (_stream_writable.js:363:3)
    at EncryptedStream.Writable.end (_stream_writable.js:341:5)

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.