blob: 44dcd691b1a6ef01058de9e754e22ce1a12aa4ad (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
require "active_support/rescuable"
class ActionMailroom::Mailbox
include ActiveSupport::Rescuable
class << self
def receive(inbound_email)
new(inbound_email).perform_processing
end
def routing(routes)
@router = ActionMailroom::Router.new(routes)
end
end
attr_reader :inbound_email
delegate :mail, to: :inbound_email
def initialize(inbound_email)
@inbound_email = inbound_email
end
def perform_processing
inbound_email.processing!
process
inbound_email.delivered!
rescue => exception
inbound_email.failed!
rescue_with_handler(exception) || raise
end
def process
# Overwrite in subclasses
end
end
|