aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/action_mailbox/ingresses/sendgrid/inbound_emails_controller.rb
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2018-10-06 22:02:08 -0400
committerGeorge Claghorn <george@basecamp.com>2018-10-11 12:51:13 -0400
commit6b7eac5c51cbef4acd1ab7f48884e7b614f71678 (patch)
tree8eb6b0ebee4ad6073f6cb48b3effc60d4262d2f2 /app/controllers/action_mailbox/ingresses/sendgrid/inbound_emails_controller.rb
parent47445511862a4c9979fb46889011edf585391091 (diff)
downloadrails-6b7eac5c51cbef4acd1ab7f48884e7b614f71678.tar.gz
rails-6b7eac5c51cbef4acd1ab7f48884e7b614f71678.tar.bz2
rails-6b7eac5c51cbef4acd1ab7f48884e7b614f71678.zip
Accept inbound emails from a variety of ingresses
Diffstat (limited to 'app/controllers/action_mailbox/ingresses/sendgrid/inbound_emails_controller.rb')
-rw-r--r--app/controllers/action_mailbox/ingresses/sendgrid/inbound_emails_controller.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/controllers/action_mailbox/ingresses/sendgrid/inbound_emails_controller.rb b/app/controllers/action_mailbox/ingresses/sendgrid/inbound_emails_controller.rb
new file mode 100644
index 0000000000..0b9e2e1866
--- /dev/null
+++ b/app/controllers/action_mailbox/ingresses/sendgrid/inbound_emails_controller.rb
@@ -0,0 +1,16 @@
+class ActionMailbox::Ingresses::Sendgrid::InboundEmailsController < ActionMailbox::BaseController
+ cattr_accessor :username, default: "actionmailbox"
+ cattr_accessor :password
+
+ before_action :authenticate
+
+ def create
+ ActionMailbox::InboundEmail.create_and_extract_message_id! raw_email
+ head :no_content
+ end
+
+ private
+ def raw_email
+ StringIO.new params.require(:email)
+ end
+end