aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDino Maric <dino.onex@gmail.com>2018-12-16 14:27:41 +0100
committerDino Maric <dino.onex@gmail.com>2018-12-19 18:27:19 +0100
commit0298725f0269cf2fffb723200d21f21ed3a7de64 (patch)
tree5b12b4109fb2fa72631764bcc043818fab9c69d8
parent849f2b6634074d32ab35e4537f9f2852d5052e80 (diff)
downloadrails-0298725f0269cf2fffb723200d21f21ed3a7de64.tar.gz
rails-0298725f0269cf2fffb723200d21f21ed3a7de64.tar.bz2
rails-0298725f0269cf2fffb723200d21f21ed3a7de64.zip
Added logging when Message ID wasn't extracted
-rw-r--r--app/models/action_mailbox/inbound_email/message_id.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/action_mailbox/inbound_email/message_id.rb b/app/models/action_mailbox/inbound_email/message_id.rb
index 4807a2a293..f10f59ea45 100644
--- a/app/models/action_mailbox/inbound_email/message_id.rb
+++ b/app/models/action_mailbox/inbound_email/message_id.rb
@@ -25,14 +25,14 @@ module ActionMailbox::InboundEmail::MessageId
private
def extract_message_id(source)
- Mail.from_source(source).message_id
- rescue => e
- # FIXME: Add logging with "Couldn't extract Message ID, so will generating a new random ID instead"
+ Mail.from_source(source).message_id rescue nil
end
end
private
def generate_missing_message_id
- self.message_id ||= Mail::MessageIdField.new.message_id
+ self.message_id ||= Mail::MessageIdField.new.message_id.tap do |message_id|
+ logger.warn "Message-ID couldn't be parsed or is missing. Generated a new Message-ID: #{message_id}"
+ end
end
end