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.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install mail_room
You will also need to install
letter_opener if you use the
letter_opener delivery methods, respectively.
mail_room -c /path/to/config.yml
--- :mailboxes: - :email: "email@example.com" :password: "password" :name: "inbox" :delivery_url: "http://localhost:3000/inbox" :delivery_token: "abcdefg" - :email: "firstname.lastname@example.org" :password: "password" :name: "inbox" :delivery_method: postback :delivery_url: "http://localhost:3000/inbox" :delivery_token: "abcdefg" - :email: "email@example.com" :password: "password" :name: "inbox" :delivery_method: logger :log_path: "/var/log/user3-email.log" - :email: "firstname.lastname@example.org" :password: "password" :name: "inbox" :delivery_method: letter_opener :location: "/tmp/user4-email"
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
The default delivery method, requires
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.
:log_path: is not provided, defaults to
Does nothing, like it says.
letter_opener gem be installed.
Uses Ryan Bates' excellent letter_opener gem.
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
I would recommend having the
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request
- If accepted, ask for commit rights
- specs, this is just a (working) proof of concept √
- finish code for POSTing to callback with auth √
- accept mailbox configuration for one account directly on the commandline; or ask for it
- add example rails endpoint, with auth examples
- add example configs for god/upstart
- log to stdout √
- add a development mode that opens in letter_opener by ryanb √