module ActionMailbox::InboundEmail::MessageId

def create_and_extract_message_id!(source, **options)

it as an attribute on the new +InboundEmail+.
attachment called +raw_email+. Before the upload, extract the Message-ID from the +source+ and set
Create a new +InboundEmail+ from the raw +source+ of the email, which is uploaded as an Active Storage
def create_and_extract_message_id!(source, **options)
  message_checksum = OpenSSL::Digest::SHA1.hexdigest(source)
  message_id = extract_message_id(source) || generate_missing_message_id(message_checksum)
  create! raw_email: create_and_upload_raw_email!(source),
    message_id: message_id, message_checksum: message_checksum, **options
rescue ActiveRecord::RecordNotUnique
  nil
end