diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2018-09-28 12:19:43 -0700 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2018-09-28 12:19:43 -0700 |
commit | 8a0a1034955544ee2e4c1f85317c0db84f3aa55b (patch) | |
tree | 1e00acdce252b2ce505ff2e8f9f5acd4ba19bbeb /app/controllers/action_mailbox/inbound_emails_controller.rb | |
parent | 5ad0813322820a6c42d7b3074531ac40108bfb69 (diff) | |
download | rails-8a0a1034955544ee2e4c1f85317c0db84f3aa55b.tar.gz rails-8a0a1034955544ee2e4c1f85317c0db84f3aa55b.tar.bz2 rails-8a0a1034955544ee2e4c1f85317c0db84f3aa55b.zip |
ActionMailroom -> ActionMailbox
We didn't end up using the mailroom metaphor directly, so let's stick with a more conventional naming strategy.
Diffstat (limited to 'app/controllers/action_mailbox/inbound_emails_controller.rb')
-rw-r--r-- | app/controllers/action_mailbox/inbound_emails_controller.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/action_mailbox/inbound_emails_controller.rb b/app/controllers/action_mailbox/inbound_emails_controller.rb new file mode 100644 index 0000000000..ec9bd6f229 --- /dev/null +++ b/app/controllers/action_mailbox/inbound_emails_controller.rb @@ -0,0 +1,17 @@ +# TODO: Add access protection using basic auth with verified tokens. Maybe coming from credentials by default? +# TODO: Spam/malware catching? +# TODO: Specific bounces for SMTP good citizenship: 200/404/400 +class ActionMailbox::InboundEmailsController < ActionController::Base + skip_forgery_protection + before_action :require_rfc822_message, only: :create + + def create + ActionMailbox::InboundEmail.create_and_extract_message_id!(params[:message]) + head :created + end + + private + def require_rfc822_message + head :unsupported_media_type unless params.require(:message).content_type == 'message/rfc822' + end +end |