rails provides rake tasks to forward mails to action mailbox's relay ingress.
that's fine unless you have your mail server(s) on another system and don't want to install rails (and all dependencies, i.e. the ruby runtime).
since the rake tasks basically just upload stdin to your rails app via http you can do everything with curl.
action-mailbox-relayer.sh
#!/usr/bin/env sh
curl -sS -u "actionmailbox:$INGRESS_PASSWORD" \
-A "Action Mailbox curl relayer" \
-H "Content-Type: message/rfc822" \
--data-binary @- \
$URL
- the basic auth username actionmailbox is the current default and may be subject to change
- make sure the INGRESS_PASSWORD environment variable contains your action mailbox password (see
rails credentials:edit
) - supply your rails app's ingress url with the URL env var (
URL="https://example.com/rails/action_mailbox/relay/inbound_emails"
) - make sure you use tls in production because you're transporting a password and possibly sensible user data
then configure your mail system to pipe email to this script.
/etc/aliases
# ...
actionmailbox: "|/path/to/action-mailbox-relayer.sh"