Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

kimmelsg/actionmailbox-imap

Repository files navigation

ActionMailbox::IMAP

CircleCI RubyGems Standard

A IMAP relay for ActionMailbox.

This is a very simple gem that provides a rake task attempt to relay messsages to ActionMailbox from the ActionMailbox::IMAP Client.

If a message is successuflly relayed to ActionMailbox, then the message will be marked deleted. If a message is not successfully relayed to ActionMailbox, then the message will be marked flagged.

Why it was created

It seems that there is no plans to create some sort of IMAP implementation relay in ActionMailbox. rails/actionmailbox#14

There is probably a reason for this. We did not want to setup or maintain a mailserver which would probably be the route to go for a robust inbound email application.

Usage

Install ActionMailbox

Per ActionMailbox documentation

$ rails action_mailbox:install
$ rails db:migrate
# config/environments/production.rb
config.action_mailbox.ingress = :relay
$ rails credentials:edit
action_mailbox:
    ingress_password: "YourIngressPassword"

Install ActionMailbox::IMAP

$ rails g imap:install

Prepare your IMAP server and account by ensuring/creating the mailboxes for ingress_mailbox, ex: "INBOX".

Update the config/actionmailbox_imap.yml that was generated to include server and credentials information, mailbox. Currently SSL is required.

Run the ActionMailbox::IMAP Client like so URL=... INGRESS_PASSWORD=... RUBY=ruby BUNDLE=bundle ./actionmailbox-imap from within rails root to begin processing emails.

NOTE: Running the client will begin immediately begin processing unread emails in the configured mailbox. The server (URL) needs to be running. You may also want to start from a empty, or plan on watching the process to ensure no performance issues occur.

Rake Task

The rake task behaves much like that of the other action_mailbox:ingress:... commands in that it relays the message the same way.

Installation

Add this line to your application's Gemfile:

gem 'actionmailbox-imap'

And then execute:

$ bundle

Or install it yourself as:

$ gem install actionmailbox-imap

Contributing

Want to contribute? Please do. PR's and passing tests (lint, test) will be required.

License

The gem is available as open source under the terms of the MIT License.