Class: ActionMailbox::Ingresses::Mailpace::InboundEmailsController
- Inherits:
-
BaseController
- Object
- BaseController
- ActionMailbox::Ingresses::Mailpace::InboundEmailsController
- Defined in:
- app/controllers/action_mailbox/ingresses/mailpace/inbound_emails_controller.rb
Overview
Ingests inbound emails from MailPace. Uses the a raw parameter containing the full RFC 822 message.
Authenticates requests using HTTP basic access authentication. The username is always actionmailbox, and the
password is read from the application's encrypted credentials or an environment variable. See the Usage section.
Returns:
- 204 No Content if an inbound email is successfully recorded and enqueued for routing
- 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 MailPace
- 422 Unprocessable Entity if the request is missing the required
RawEmailparameter - 500 Server Error if the ingress password is not configured, or if one of the Active Record database, the Active Storage service, or the Active Job backend is misconfigured or unavailable
Usage
-
Tell Action Mailbox to accept emails from MailPace:
# config/environments/production.rb config.action_mailbox.ingress = :mailpace -
Generate a strong password that Action Mailbox can use to authenticate requests to the MailPace ingress.
Use bin/rails credentials:edit to add the password to your application's encrypted credentials under
action_mailbox.ingress_password, where Action Mailbox will automatically find it:action_mailbox: ingress_password: ...Alternatively, provide the password in the
RAILS_INBOUND_EMAIL_PASSWORDenvironment variable. -
Configure MailPace to forward inbound emails to
/rails/action_mailbox/mailpace/inbound_emailswith the usernameactionmailboxand the password you previously generated. If your application lived at https://example.com, you would configure your MailPace inbound endpoint URL with the following fully-qualified URL:https://actionmailbox:[email protected]/rails/action_mailbox/mailpace/inbound_emails
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
47 48 49 50 51 52 53 |
# File 'app/controllers/action_mailbox/ingresses/mailpace/inbound_emails_controller.rb', line 47 def create ActionMailbox::InboundEmail. params.require('raw') rescue ActionController::ParameterMissing => e logger.error e. head :unprocessable_entity end |