From 6c07f62cfc40dc7062c9fc883d0de20ee35e842f Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Tue, 18 Nov 2025 02:03:08 -0800 Subject: [PATCH] feat: Add Amazon SES inbound email support (#12893) ## Summary - add AWS ActionMailbox SES gems - document SES as incoming email provider - note SES option in configuration ## Testing - `bundle exec rubocop config/initializers/mailer.rb config/environments/production.rb Gemfile` ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_68bbb7d482288326b8f04bb795af0322) --------- Co-authored-by: Pranav Co-authored-by: Vinay Keerthi <11478411+stonecharioteer@users.noreply.github.com> --- .env.example | 5 +++++ Gemfile | 3 +++ Gemfile.lock | 14 +++++++++++--- config/initializers/mailer.rb | 4 ++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 3ff349ffc..9031fc08a 100644 --- a/.env.example +++ b/.env.example @@ -105,6 +105,7 @@ MAILER_INBOUND_EMAIL_DOMAIN= # mandrill for Mandrill # postmark for Postmark # sendgrid for Sendgrid +# ses for Amazon SES RAILS_INBOUND_EMAIL_SERVICE= # Use one of the following based on the email ingress service # Ref: https://edgeguides.rubyonrails.org/action_mailbox_basics.html @@ -114,6 +115,10 @@ RAILS_INBOUND_EMAIL_PASSWORD= MAILGUN_INGRESS_SIGNING_KEY= MANDRILL_INGRESS_API_KEY= +# SNS topic ARN for ActionMailbox (format: arn:aws:sns:region:account-id:topic-name) +# Configure only if the rails_inbound_email_service = ses +ACTION_MAILBOX_SES_SNS_TOPIC= + # Creating Your Inbound Webhook Instructions for Postmark and Sendgrid: # Inbound webhook URL format: # https://actionmailbox:[YOUR_RAILS_INBOUND_EMAIL_PASSWORD]@[YOUR_CHATWOOT_DOMAIN.COM]/rails/action_mailbox/[RAILS_INBOUND_EMAIL_SERVICE]/inbound_emails diff --git a/Gemfile b/Gemfile index abbd3332f..31ecf5b3c 100644 --- a/Gemfile +++ b/Gemfile @@ -55,6 +55,9 @@ gem 'azure-storage-blob', git: 'https://github.com/chatwoot/azure-storage-ruby', gem 'google-cloud-storage', '>= 1.48.0', require: false gem 'image_processing' +##-- for actionmailbox --## +gem 'aws-actionmailbox-ses', '~> 0' + ##-- gems for database --# gem 'groupdate' gem 'pg' diff --git a/Gemfile.lock b/Gemfile.lock index 99e75b33c..6af8c0e7c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -136,9 +136,13 @@ GEM audited (5.4.1) activerecord (>= 5.0, < 7.7) activesupport (>= 5.0, < 7.7) + aws-actionmailbox-ses (0.1.0) + actionmailbox (>= 7.1.0) + aws-sdk-s3 (~> 1, >= 1.123.0) + aws-sdk-sns (~> 1, >= 1.61.0) aws-eventstream (1.2.0) aws-partitions (1.760.0) - aws-sdk-core (3.171.1) + aws-sdk-core (3.188.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.5) @@ -146,10 +150,13 @@ GEM aws-sdk-kms (1.64.0) aws-sdk-core (~> 3, >= 3.165.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.122.0) - aws-sdk-core (~> 3, >= 3.165.0) + aws-sdk-s3 (1.126.0) + aws-sdk-core (~> 3, >= 3.174.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.4) + aws-sdk-sns (1.70.0) + aws-sdk-core (~> 3, >= 3.188.0) + aws-sigv4 (~> 1.1) aws-sigv4 (1.5.2) aws-eventstream (~> 1, >= 1.0.2) barnes (0.0.9) @@ -995,6 +1002,7 @@ DEPENDENCIES annotate attr_extras audited (~> 5.4, >= 5.4.1) + aws-actionmailbox-ses (~> 0) aws-sdk-s3 azure-storage-blob! barnes diff --git a/config/initializers/mailer.rb b/config/initializers/mailer.rb index a0e5d7b73..3d585d8b6 100644 --- a/config/initializers/mailer.rb +++ b/config/initializers/mailer.rb @@ -46,5 +46,9 @@ Rails.application.configure do # :mandrill for Mandrill # :postmark for Postmark # :sendgrid for Sendgrid + # :ses for Amazon SES config.action_mailbox.ingress = ENV.fetch('RAILS_INBOUND_EMAIL_SERVICE', 'relay').to_sym + + # Amazon SES ActionMailbox configuration + config.action_mailbox.ses.subscribed_topic = ENV['ACTION_MAILBOX_SES_SNS_TOPIC'] if ENV['ACTION_MAILBOX_SES_SNS_TOPIC'].present? end