Class: ActionMailbox::Ingresses::Ses::InboundEmailsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/action_mailbox/ingresses/ses/inbound_emails_controller.rb

Overview

Ingests inbound emails from Amazon SES/SNS and confirms subscriptions.

Subscription requests must provide the following parameters in a JSON body:

  • Message: Notification content

  • MessagId: Notification unique identifier

  • Timestamp: iso8601 timestamp

  • TopicArn: Topic identifier

  • Type: Type of event (“Subscription”)

Inbound email events must provide the following parameters in a JSON body:

  • Message: Notification content

  • MessagId: Notification unique identifier

  • Timestamp: iso8601 timestamp

  • SubscribeURL: Topic identifier

  • TopicArn: Topic identifier

  • Type: Type of event (“SubscriptionConfirmation”)

All requests are authenticated by validating the provided AWS signature.

Returns:

  • 204 No Content if a request is successfully processed

  • 401 Unauthorized if a request does not contain a valid signature

  • 404 Not Found if the Amazon ingress has not been configured

  • 422 Unprocessable Entity if a request provides invalid parameters

Instance Method Summary collapse

Instance Method Details

#createObject



36
37
38
39
40
41
# File 'app/controllers/action_mailbox/ingresses/ses/inbound_emails_controller.rb', line 36

def create
  head :bad_request unless notification.message_content.present?

  ActionMailbox::InboundEmail.create_and_extract_message_id!(notification.message_content)
  head :no_content
end