aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_mailroom/mailbox.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/action_mailroom/mailbox.rb')
-rw-r--r--lib/action_mailroom/mailbox.rb45
1 files changed, 0 insertions, 45 deletions
diff --git a/lib/action_mailroom/mailbox.rb b/lib/action_mailroom/mailbox.rb
deleted file mode 100644
index 936054810f..0000000000
--- a/lib/action_mailroom/mailbox.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-require "active_support/rescuable"
-
-require "action_mailroom/mailbox/callbacks"
-require "action_mailroom/mailbox/routing"
-
-class ActionMailroom::Mailbox
- include ActiveSupport::Rescuable
- include Callbacks, Routing
-
- attr_reader :inbound_email
- delegate :mail, :bounced!, to: :inbound_email
-
- def self.receive(inbound_email)
- new(inbound_email).perform_processing
- end
-
- def initialize(inbound_email)
- @inbound_email = inbound_email
- end
-
- def perform_processing
- run_callbacks :process do
- track_status_of_inbound_email do
- process
- end
- end
- rescue => exception
- # TODO: Include a reference to the inbound_email in the exception raised so error handling becomes easier
- rescue_with_handler(exception) || raise
- end
-
- def process
- # Overwrite in subclasses
- end
-
- private
- def track_status_of_inbound_email
- inbound_email.processing!
- yield
- inbound_email.delivered! unless inbound_email.bounced?
- rescue => exception
- inbound_email.failed!
- raise
- end
-end