module ActionMailbox::InboundEmail::MessageId
def create_and_extract_message_id!(source, **options)
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 = Digest::SHA1.hexdigest(source) message_id = extract_message_id(source) || generate_missing_message_id(message_checksum) create! options.merge(message_id: message_id, message_checksum: message_checksum) do |inbound_email| inbound_email.raw_email.attach io: StringIO.new(source), filename: "message.eml", content_type: "message/rfc822" end rescue ActiveRecord::RecordNotUnique nil end