Coder Social home page Coder Social logo

mail_room's Introduction

developmental work for non gmail servers for mail_room

mail_room is a configuration based process that will idle on IMAP connections and POST to a delivery URL whenever a new message is received on the configured mailbox and folder.

Build Status Code Climate

Installation

Add this line to your application's Gemfile:

gem 'mail_room'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mail_room

You will also need to install faraday or letter_opener if you use the postback or letter_opener delivery methods, respectively.

Usage

mail_room -c /path/to/config.yml

Configuration

---
:mailboxes:
  -
    :email: "[email protected]"
    :password: "password"
    :name: "inbox"
    :delivery_url: "http://localhost:3000/inbox"
    :delivery_token: "abcdefg"
  -
    :email: "[email protected]"
    :password: "password"
    :name: "inbox"
    :delivery_method: postback
    :delivery_url: "http://localhost:3000/inbox"
    :delivery_token: "abcdefg"
  -
    :email: "[email protected]"
    :password: "password"
    :name: "inbox"
    :delivery_method: logger
    :log_path: "/var/log/user3-email.log"
  -
    :email: "[email protected]"
    :password: "password"
    :name: "inbox"
    :delivery_method: letter_opener
    :location: "/tmp/user4-email"

delivery_method

postback

Requires faraday gem be installed.

NOTE: If you're using Ruby >= 2.0, you'll need to use Faraday from >= 0.8.9. Versions before this seem to have some weird behavior with mail_room.

The default delivery method, requires delivery_url and delivery_token in configuration.

As the postback is essentially using your app as if it were an API endpoint, you may need to disable forgery protection as you would with a JSON API. In our case, the postback is plaintext, but the protection will still need to be disabled.

logger

Configured with :delivery_method: logger.

If :log_path: is not provided, defaults to STDOUT

noop

Configured with :delivery_method: noop.

Does nothing, like it says.

letter_opener

Requires letter_opener gem be installed.

Configured with :delivery_method: letter_opener.

Uses Ryan Bates' excellent letter_opener gem.

Receiving postback in Rails

If you have a controller that you're sending to, with forgery protection disabled, you can get the raw string of the email using request.body.read.

I would recommend having the mail gem bundled and parse the email using Mail.read_from_string(request.body.read).

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
  6. If accepted, ask for commit rights

TODO

  1. specs, this is just a (working) proof of concept √
  2. finish code for POSTing to callback with auth √
  3. accept mailbox configuration for one account directly on the commandline; or ask for it
  4. add example rails endpoint, with auth examples
  5. add example configs for god/upstart
  6. log to stdout √
  7. add a development mode that opens in letter_opener by ryanb √

mail_room's People

Contributors

tpitale avatar matte avatar sahild avatar dringoen avatar

Watchers

 avatar

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.