- Defined in:
Ingests inbound emails from SendGrid. Requires an
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 below.
Note that basic authentication is insecure over unencrypted HTTP. An attacker that intercepts cleartext requests to the SendGrid ingress can learn its password. You should only use the SendGrid ingress over HTTPS.
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 SendGrid
422 Unprocessable Entityif the request is missing the required
500 Server Errorif 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
Tell Action Mailbox to accept emails from SendGrid:
# config/environments/production.rb config.action_mailbox.ingress = :sendgrid
Generate a strong password that Action Mailbox can use to authenticate requests to the SendGrid ingress.
bin/rails credentials:editto 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
Configure SendGrid Inbound Parse to forward inbound emails to
/rails/action_mailbox/sendgrid/inbound_emailswith the username
actionmailboxand the password you previously generated. If your application lived at
https://example.com, you would configure SendGrid with the following fully-qualified URL:
NOTE: When configuring your SendGrid Inbound Parse webhook, be sure to check the box labeled *“Post the raw, full MIME message.”* Action Mailbox needs the raw MIME message to work.
Instance Method Summary collapse
Instance Method Details
51 52 53 54 55 56
# File 'actionmailbox/app/controllers/action_mailbox/ingresses/sendgrid/inbound_emails_controller.rb', line 51 def create ::. mail rescue JSON::ParserError => error logger.error error. head :unprocessable_entity end