class ActionMailbox::Ingresses::Relay::InboundEmailsController
-
Qmail (
bin/rails action_mailbox:ingress:qmail)<br>- Postfix (<tt>bin/rails action_mailbox:ingress:postfix)<br>- Exim (<tt>bin/rails action_mailbox:ingress:exim)<br><br>Built-in ingress commands are available for these popular SMTP servers:<br><br>bin/rails action_mailbox:ingress:postfix URL=https://example.com/rails/action_mailbox/postfix/inbound_emails INGRESS_PASSWORD=...<br><br>inbound emails to the following command:<br>If your application lives at <tt>https://example.com
, you would configure the Postfix SMTP server to pipe
relay ingress and theINGRESS_PASSWORD
you previously generated.
3. Configure your SMTP server to pipe inbound emails to the appropriate ingress command, providing theURL
of the
Alternatively, provide the password in theRAILS_INBOUND_EMAIL_PASSWORD
environment variable.
ingress_password: …
action_mailbox:action_mailbox.ingress_password
, where Action Mailbox will automatically find it:
Usebin/rails credentials:edit
to add the password to your application’s encrypted credentials under
2. Generate a strong password that Action Mailbox can use to authenticate requests to the ingress.
config.action_mailbox.ingress = :relay
# config/environments/production.rb
1. Tell Action Mailbox to accept emails from an SMTP relay:
== Usage
the Active Storage service, or the Active Job backend is misconfigured or unavailable
-500 Server Error
if the ingress password is not configured, or if one of the Active Record database,
-415 Unsupported Media Type
if the request does not contain an RFC 822 message
-404 Not Found
if Action Mailbox is not configured to accept inbound emails relayed from an SMTP server
-401 Unauthorized
if the request could not be authenticated
-204 No Content
if an inbound email is successfully recorded and enqueued for routing to the appropriate mailbox
Returns:
the ingress can learn its password. You should only use this ingress over HTTPS.
Note that basic authentication is insecure over unencrypted HTTP. An attacker that intercepts cleartext requests to
password is read from the application’s encrypted credentials or an environment variable. See the Usage section below.
Authenticates requests using HTTP basic access authentication. The username is alwaysactionmailbox
, and the
Ingests inbound emails relayed from an SMTP server.
def create
def create ActionMailbox::InboundEmail.create_and_extract_message_id! request.body.read end
def require_valid_rfc822_message
def require_valid_rfc822_message unless request.media_type == "message/rfc822" head :unsupported_media_type end end