Permalink
Browse files

Inbound email processing

  • Loading branch information...
1 parent d044ada commit c4d73c62b99a3f1ef5783db867a10910c9562027 @rwdaigle committed May 22, 2012
Showing with 23 additions and 0 deletions.
  1. +10 −0 app/controllers/emails_controller.rb
  2. +11 −0 app/loaders/inbound_email_loader.rb
  3. +2 −0 config/routes.rb
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'

0 comments on commit c4d73c6

Please sign in to comment.