diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2018-09-17 16:55:07 -0700 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2018-09-17 16:55:07 -0700 |
commit | 627bbd34e142fa7caff49fd660a9a586f3ed6826 (patch) | |
tree | c068e6a777d7fd7441f7fb6c5cbfb9e6e3bf29c6 /app/models/action_mailbox | |
parent | 52b1e2c6cfd5e76d72a6de09b28e51f2440c48c4 (diff) | |
download | rails-627bbd34e142fa7caff49fd660a9a586f3ed6826.tar.gz rails-627bbd34e142fa7caff49fd660a9a586f3ed6826.tar.bz2 rails-627bbd34e142fa7caff49fd660a9a586f3ed6826.zip |
Add inbound email
Diffstat (limited to 'app/models/action_mailbox')
-rw-r--r-- | app/models/action_mailbox/inbound_email.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/models/action_mailbox/inbound_email.rb b/app/models/action_mailbox/inbound_email.rb new file mode 100644 index 0000000000..3e528b6642 --- /dev/null +++ b/app/models/action_mailbox/inbound_email.rb @@ -0,0 +1,17 @@ +class ActionMailbox::InboundEmail < ActiveRecord::Base + self.table_name = "action_mailbox_inbound_email" + + after_create_commit :deliver_to_mailroom_later + has_one_attached :raw_message + + enum status: %i[ pending processing delivered failed bounced ] + + def mail + @mail ||= Mail.new(Mail::Utilities.binary_unsafe_to_crlf(raw_message.download)) + end + + private + def deliver_to_mailroom_later + ActionMailbox::DeliverInboundEmailToMailroomJob.perform_later self + end +end |