From 0f140fe15852b829d22864a2f7664440204ac723 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 18 Sep 2018 16:42:38 -0700 Subject: Add callbacks --- lib/action_mailroom/mailbox.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/action_mailroom/mailbox.rb') diff --git a/lib/action_mailroom/mailbox.rb b/lib/action_mailroom/mailbox.rb index 44dcd691b1..0d03f4be6b 100644 --- a/lib/action_mailroom/mailbox.rb +++ b/lib/action_mailroom/mailbox.rb @@ -1,7 +1,8 @@ require "active_support/rescuable" +require "action_mailroom/mailbox/callbacks" class ActionMailroom::Mailbox - include ActiveSupport::Rescuable + include ActiveSupport::Rescuable, Callbacks class << self def receive(inbound_email) @@ -22,7 +23,11 @@ class ActionMailroom::Mailbox def perform_processing inbound_email.processing! - process + + run_callbacks :process do + process + end + inbound_email.delivered! rescue => exception inbound_email.failed! -- cgit v1.2.3