diff options
author | George Claghorn <george@basecamp.com> | 2018-10-06 22:02:08 -0400 |
---|---|---|
committer | George Claghorn <george@basecamp.com> | 2018-10-11 12:51:13 -0400 |
commit | 6b7eac5c51cbef4acd1ab7f48884e7b614f71678 (patch) | |
tree | 8eb6b0ebee4ad6073f6cb48b3effc60d4262d2f2 /app/models/action_mailbox/inbound_email/message_id.rb | |
parent | 47445511862a4c9979fb46889011edf585391091 (diff) | |
download | rails-6b7eac5c51cbef4acd1ab7f48884e7b614f71678.tar.gz rails-6b7eac5c51cbef4acd1ab7f48884e7b614f71678.tar.bz2 rails-6b7eac5c51cbef4acd1ab7f48884e7b614f71678.zip |
Accept inbound emails from a variety of ingresses
Diffstat (limited to 'app/models/action_mailbox/inbound_email/message_id.rb')
-rw-r--r-- | app/models/action_mailbox/inbound_email/message_id.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/action_mailbox/inbound_email/message_id.rb b/app/models/action_mailbox/inbound_email/message_id.rb index 590dbfc4d7..601c5f1a7e 100644 --- a/app/models/action_mailbox/inbound_email/message_id.rb +++ b/app/models/action_mailbox/inbound_email/message_id.rb @@ -7,7 +7,14 @@ module ActionMailbox::InboundEmail::MessageId module ClassMethods def create_and_extract_message_id!(raw_email, **options) - create! raw_email: raw_email, message_id: extract_message_id(raw_email), **options + create! message_id: extract_message_id(raw_email), **options do |inbound_email| + case raw_email + when ActionDispatch::Http::UploadedFile + inbound_email.raw_email.attach raw_email + else + inbound_email.raw_email.attach io: raw_email.tap(&:rewind), filename: "message.eml", content_type: "message/rfc822" + end + end end private |