Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Inbound email processing

  • Loading branch information...
commit c4d73c62b99a3f1ef5783db867a10910c9562027 1 parent d044ada
@rwdaigle authored
View
10 app/controllers/emails_controller.rb
@@ -0,0 +1,10 @@
+class EmailsController < ApplicationController
+
+ skip_before_filter :verify_authenticity_token, :login_required
+
+ def create
+ InboundEmailLoader.load!(params['from'], params["subject"])
+ # $queue.enqueue('InboundEmailLoader.load!', params['from'], params["subject"])
+ render :text => "OK"
+ end
+end
View
11 app/loaders/inbound_email_loader.rb
@@ -0,0 +1,11 @@
+class InboundEmailLoader
+
+ class << self
+
+ def load!(from, text)
+ log({event: "email-import", from: from, text: text}) do
+ Subject.add_vocabulary_word(text)
+ end
+ end
+ end
+end
View
2  config/routes.rb
@@ -40,6 +40,8 @@
end
end
end
+
+ resources :emails, :only => [:create]
# Niceities
match 'login', :to => 'sessions#new'
Please sign in to comment.
Something went wrong with that request. Please try again.