instance method
create_and_extract_message_id!
Ruby on Rails 6.1.7.10
Since v6.0.6Signature
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
-
sourcereq -
optionskeyrest
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