instance method create_and_extract_message_id!

Ruby on Rails 6.1.7.10

Since v6.0.6

Available in: v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

create_and_extract_message_id!(source, **options)

Create a new InboundEmail from the raw source of the email, which is uploaded as an Active Storage attachment called raw_email. Before the upload, extract the Message-ID from the source and set it as an attribute on the new InboundEmail.

Parameters

source req
options keyrest
Source
# File actionmailbox/app/models/action_mailbox/inbound_email/message_id.rb, line 16
    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

Defined in actionmailbox/app/models/action_mailbox/inbound_email/message_id.rb line 16 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionMailbox::InboundEmail::MessageId

Type at least 2 characters to search.

↑↓ navigate · open · esc close