aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailbox
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2019-04-14 12:15:54 -0400
committerGitHub <noreply@github.com>2019-04-14 12:15:54 -0400
commitf480cfabcd9000b5817b610e21466299025b12d2 (patch)
tree7ff1d11bae5f2b781cd48d0465dc87d3decbae52 /actionmailbox
parent00b0c84a9b78ce720700b04cf5d1c5f091fe63ca (diff)
downloadrails-f480cfabcd9000b5817b610e21466299025b12d2.tar.gz
rails-f480cfabcd9000b5817b610e21466299025b12d2.tar.bz2
rails-f480cfabcd9000b5817b610e21466299025b12d2.zip
Remove the Amazon SES ingress
It's unusable and not ready to ship in Rails 6.0. We'll rewrite it for 6.1.
Diffstat (limited to 'actionmailbox')
-rw-r--r--actionmailbox/README.md2
-rw-r--r--actionmailbox/app/controllers/action_mailbox/base_controller.rb4
-rw-r--r--actionmailbox/app/controllers/action_mailbox/ingresses/amazon/inbound_emails_controller.rb54
-rw-r--r--actionmailbox/config/routes.rb1
-rw-r--r--actionmailbox/lib/action_mailbox/engine.rb11
-rw-r--r--actionmailbox/lib/rails/generators/installer.rb2
-rw-r--r--actionmailbox/test/controllers/ingresses/amazon/inbound_emails_controller_test.rb22
-rw-r--r--actionmailbox/test/dummy/config/environments/production.rb11
8 files changed, 9 insertions, 98 deletions
diff --git a/actionmailbox/README.md b/actionmailbox/README.md
index 9a47223d3b..593bd429ae 100644
--- a/actionmailbox/README.md
+++ b/actionmailbox/README.md
@@ -1,6 +1,6 @@
# Action Mailbox
-Action Mailbox routes incoming emails to controller-like mailboxes for processing in Rails. It ships with ingresses for Amazon SES, Mailgun, Mandrill, Postmark, and SendGrid. You can also handle inbound mails directly via the built-in Exim, Postfix, and Qmail ingresses.
+Action Mailbox routes incoming emails to controller-like mailboxes for processing in Rails. It ships with ingresses for Mailgun, Mandrill, Postmark, and SendGrid. You can also handle inbound mails directly via the built-in Exim, Postfix, and Qmail ingresses.
The inbound emails are turned into `InboundEmail` records using Active Record and feature lifecycle tracking, storage of the original email on cloud storage via Active Storage, and responsible data handling with on-by-default incineration.
diff --git a/actionmailbox/app/controllers/action_mailbox/base_controller.rb b/actionmailbox/app/controllers/action_mailbox/base_controller.rb
index 92477b86a8..80a14355b7 100644
--- a/actionmailbox/app/controllers/action_mailbox/base_controller.rb
+++ b/actionmailbox/app/controllers/action_mailbox/base_controller.rb
@@ -7,10 +7,6 @@ module ActionMailbox
before_action :ensure_configured
- def self.prepare
- # Override in concrete controllers to run code on load.
- end
-
private
def ensure_configured
unless ActionMailbox.ingress == ingress_name
diff --git a/actionmailbox/app/controllers/action_mailbox/ingresses/amazon/inbound_emails_controller.rb b/actionmailbox/app/controllers/action_mailbox/ingresses/amazon/inbound_emails_controller.rb
deleted file mode 100644
index e0a187054e..0000000000
--- a/actionmailbox/app/controllers/action_mailbox/ingresses/amazon/inbound_emails_controller.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-# frozen_string_literal: true
-
-module ActionMailbox
- # Ingests inbound emails from Amazon's Simple Email Service (SES).
- #
- # Requires the full RFC 822 message in the +content+ parameter. Authenticates requests by validating their signatures.
- #
- # Returns:
- #
- # - <tt>204 No Content</tt> if an inbound email is successfully recorded and enqueued for routing to the appropriate mailbox
- # - <tt>401 Unauthorized</tt> if the request's signature could not be validated
- # - <tt>404 Not Found</tt> if Action Mailbox is not configured to accept inbound emails from SES
- # - <tt>422 Unprocessable Entity</tt> if the request is missing the required +content+ parameter
- # - <tt>500 Server Error</tt> if one of the Active Record database, the Active Storage service, or
- # the Active Job backend is misconfigured or unavailable
- #
- # == Usage
- #
- # 1. Install the {aws-sdk-sns}[https://rubygems.org/gems/aws-sdk-sns] gem:
- #
- # # Gemfile
- # gem "aws-sdk-sns", ">= 1.9.0", require: false
- #
- # 2. Tell Action Mailbox to accept emails from SES:
- #
- # # config/environments/production.rb
- # config.action_mailbox.ingress = :amazon
- #
- # 3. {Configure SES}[https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-notifications.html]
- # to deliver emails to your application via POST requests to +/rails/action_mailbox/amazon/inbound_emails+.
- # If your application lived at <tt>https://example.com</tt>, you would specify the fully-qualified URL
- # <tt>https://example.com/rails/action_mailbox/amazon/inbound_emails</tt>.
- class Ingresses::Amazon::InboundEmailsController < BaseController
- before_action :authenticate
-
- cattr_accessor :verifier
-
- def self.prepare
- self.verifier ||= begin
- require "aws-sdk-sns"
- Aws::SNS::MessageVerifier.new
- end
- end
-
- def create
- ActionMailbox::InboundEmail.create_and_extract_message_id! params.require(:content)
- end
-
- private
- def authenticate
- head :unauthorized unless verifier.authentic?(request.body)
- end
- end
-end
diff --git a/actionmailbox/config/routes.rb b/actionmailbox/config/routes.rb
index 517d2835af..1496d6f0b3 100644
--- a/actionmailbox/config/routes.rb
+++ b/actionmailbox/config/routes.rb
@@ -2,7 +2,6 @@
Rails.application.routes.draw do
scope "/rails/action_mailbox", module: "action_mailbox/ingresses" do
- post "/amazon/inbound_emails" => "amazon/inbound_emails#create", as: :rails_amazon_inbound_emails
post "/mandrill/inbound_emails" => "mandrill/inbound_emails#create", as: :rails_mandrill_inbound_emails
post "/postmark/inbound_emails" => "postmark/inbound_emails#create", as: :rails_postmark_inbound_emails
post "/relay/inbound_emails" => "relay/inbound_emails#create", as: :rails_relay_inbound_emails
diff --git a/actionmailbox/lib/action_mailbox/engine.rb b/actionmailbox/lib/action_mailbox/engine.rb
index 039f04ac2f..bab3964d93 100644
--- a/actionmailbox/lib/action_mailbox/engine.rb
+++ b/actionmailbox/lib/action_mailbox/engine.rb
@@ -26,16 +26,7 @@ module ActionMailbox
ActionMailbox.incinerate = app.config.action_mailbox.incinerate.nil? ? true : app.config.action_mailbox.incinerate
ActionMailbox.incinerate_after = app.config.action_mailbox.incinerate_after || 30.days
ActionMailbox.queues = app.config.action_mailbox.queues || {}
- end
- end
-
- initializer "action_mailbox.ingress" do |app|
- config.to_prepare do
- if ActionMailbox.ingress = app.config.action_mailbox.ingress.presence
- if ingress_controller_class = "ActionMailbox::Ingresses::#{ActionMailbox.ingress.to_s.classify}::InboundEmailsController".safe_constantize
- ingress_controller_class.prepare
- end
- end
+ ActionMailbox.ingress = app.config.action_mailbox.ingress
end
end
end
diff --git a/actionmailbox/lib/rails/generators/installer.rb b/actionmailbox/lib/rails/generators/installer.rb
index 25cf528ef5..2864ea4e62 100644
--- a/actionmailbox/lib/rails/generators/installer.rb
+++ b/actionmailbox/lib/rails/generators/installer.rb
@@ -5,6 +5,6 @@ copy_file "#{__dir__}/mailbox/templates/application_mailbox.rb", "app/mailboxes/
environment <<~end_of_config, env: "production"
# Prepare the ingress controller used to receive mail
- # config.action_mailbox.ingress = :amazon
+ # config.action_mailbox.ingress = :postfix
end_of_config
diff --git a/actionmailbox/test/controllers/ingresses/amazon/inbound_emails_controller_test.rb b/actionmailbox/test/controllers/ingresses/amazon/inbound_emails_controller_test.rb
deleted file mode 100644
index e10985553e..0000000000
--- a/actionmailbox/test/controllers/ingresses/amazon/inbound_emails_controller_test.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-require "test_helper"
-
-ActionMailbox::Ingresses::Amazon::InboundEmailsController.verifier =
- Module.new { def self.authentic?(message); true; end }
-
-class ActionMailbox::Ingresses::Amazon::InboundEmailsControllerTest < ActionDispatch::IntegrationTest
- setup { ActionMailbox.ingress = :amazon }
-
- test "receiving an inbound email from Amazon" do
- assert_difference -> { ActionMailbox::InboundEmail.count }, +1 do
- post rails_amazon_inbound_emails_url, params: { content: file_fixture("../files/welcome.eml").read }, as: :json
- end
-
- assert_response :no_content
-
- inbound_email = ActionMailbox::InboundEmail.last
- assert_equal file_fixture("../files/welcome.eml").read, inbound_email.raw_email.download
- assert_equal "0CB459E0-0336-41DA-BC88-E6E28C697DDB@37signals.com", inbound_email.message_id
- end
-end
diff --git a/actionmailbox/test/dummy/config/environments/production.rb b/actionmailbox/test/dummy/config/environments/production.rb
index 1731582220..932858fdb6 100644
--- a/actionmailbox/test/dummy/config/environments/production.rb
+++ b/actionmailbox/test/dummy/config/environments/production.rb
@@ -1,9 +1,4 @@
Rails.application.configure do
- # Prepare the ingress controller used to receive mail
- # config.action_mailbox.ingress = :amazon
-
- # Verifies that versions and hashed value of the package contents in the project's package.json
- config.webpacker.check_yarn_integrity = false
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
@@ -96,4 +91,10 @@ Rails.application.configure do
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
+
+ # Prepare the ingress controller used to receive mail
+ # config.action_mailbox.ingress = :postfix
+
+ # Verifies that versions and hashed value of the package contents in the project's package.json
+ config.webpacker.check_yarn_integrity = false
end