blob: f2589d742925c814265b73eeaf0a8fa8728cc428 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
require "mail"
class ActionMailbox::InboundEmail < ActiveRecord::Base
self.table_name = "action_mailbox_inbound_emails"
include Incineratable, MessageId, Routable
has_one_attached :raw_email
enum status: %i[ pending processing delivered failed bounced ]
def self.mail_from_source(source)
Mail.new Mail::Utilities.binary_unsafe_to_crlf(source.to_s)
end
def mail
@mail ||= self.class.mail_from_source(source)
end
def source
@source ||= raw_email.download
end
end
|