Class: Ingresses::Mandrill::InboundEmailsController

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

Overview

Ingests inbound emails from Mandrill.

Requires a mandrill_events parameter containing a JSON array of Mandrill inbound email event objects. Each event is expected to have a msg object containing a full RFC 822 message in its raw_msg property.

Returns:

  • 204 No Content if an inbound email is successfully recorded and enqueued for routing to the appropriate mailbox

  • 401 Unauthorized if the request’s signature could not be validated

  • 404 Not Found if Action Mailbox is not configured to accept inbound emails from Mandrill

  • 422 Unprocessable Entity if the request is missing required parameters

  • 500 Server Error if the Mandrill API key is missing, or one of the Active Record database, the Active Storage service, or the Active Job backend is misconfigured or unavailable

Defined Under Namespace

Classes: Authenticator

Instance Method Summary collapse

Instance Method Details

#createObject



20
21
22
23
24
25
26
# File 'actionmailbox/app/controllers/action_mailbox/ingresses/mandrill/inbound_emails_controller.rb', line 20

def create
  raw_emails.each { |raw_email| ActionMailbox::InboundEmail.create_and_extract_message_id! raw_email }
  head :ok
rescue JSON::ParserError => error
  logger.error error.message
  head :unprocessable_entity
end

#health_checkObject



28
29
30
# File 'actionmailbox/app/controllers/action_mailbox/ingresses/mandrill/inbound_emails_controller.rb', line 28

def health_check
  head :ok
end