aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/action_mailroom/inbound_email.rb
blob: c439988e916e38037bb741815dbade092d8eec41 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require "mail"

class ActionMailroom::InboundEmail < ActiveRecord::Base
  self.table_name = "action_mailroom_inbound_emails"

  include Incineratable, Routable

  has_one_attached :raw_email
  enum status: %i[ pending processing delivered failed bounced ]

  def mail
    @mail ||= Mail.new(Mail::Utilities.binary_unsafe_to_crlf(raw_email.download))
  end
end