1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Added logging when Message ID wasn't extracted

This commit is contained in:
Dino Maric 2018-12-16 14:27:41 +01:00
parent 849f2b6634
commit 0298725f02

View file

@ -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