Class: ActionMailbox::Ingresses::Amazon::InboundEmailsController
- Inherits:
-
BaseController
- Object
- BaseController
- ActionMailbox::Ingresses::Amazon::InboundEmailsController
- Defined in:
- app/controllers/action_mailbox/ingresses/amazon/inbound_emails_controller.rb
Overview
Ingests inbound emails from Amazon’s Simple Email Service (SES).
Requires the full RFC 822 message in the content parameter. Authenticates requests by validating their signatures.
Returns:
-
204 No Contentif an inbound email is successfully recorded and enqueued for routing to the appropriate mailbox -
401 Unauthorizedif the request’s signature could not be validated -
404 Not Foundif Action Mailbox is not configured to accept inbound emails from SES -
422 Unprocessable Entityif the request is missing the requiredcontentparameter -
500 Server Errorif one of the Active Record database, the Active Storage service, or the Active Job backend is misconfigured or unavailable
Usage
-
Install the aws-sdk-sns gem:
# Gemfile gem "aws-sdk-sns", ">= 1.9.0", require: false -
Tell Action Mailbox to accept emails from SES:
# config/environments/production.rb config.action_mailbox.ingress = :amazon -
Configure SES to deliver emails to your application via POST requests to
/rails/action_mailbox/amazon/inbound_emails. If your application lived athttps://example.com, you would specify the fully-qualified URLhttps://example.com/rails/action_mailbox/amazon/inbound_emails.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.prepare ⇒ Object
35 36 37 38 39 40 |
# File 'app/controllers/action_mailbox/ingresses/amazon/inbound_emails_controller.rb', line 35 def self.prepare self.verifier ||= begin require "aws-sdk-sns/message_verifier" Aws::SNS::MessageVerifier.new end end |
Instance Method Details
#create ⇒ Object
42 43 44 |
# File 'app/controllers/action_mailbox/ingresses/amazon/inbound_emails_controller.rb', line 42 def create ActionMailbox::InboundEmail. params.require(:content) end |