aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/action_mailroom/inbound_emails_controller.rb
blob: 0c74d4b29af07953b61c0c1a1bb320ebed11bba7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class ActionMailroom::InboundEmailsController < ActionController::Base
  skip_forgery_protection
  before_action :require_rfc822_message

  def create
    ActionMailroom::InboundEmail.create!(raw_email: params[:message])
    head :created
  end

  private
    def require_rfc822_message
      head :unsupported_media_type unless params.require(:message).content_type == 'message/rfc822'
    end
end