method

wrap_inline_attachments

Importance_0
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: ActionMailer::Base
wrap_inline_attachments(message) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionmailer/lib/action_mailer/base.rb, line 1019
      def wrap_inline_attachments(message)
        # If we have both types of attachment, wrap all the inline attachments
        # in multipart/related, but not the actual attachments
        if message.attachments.detect(&:inline?) && message.attachments.detect { |a| !a.inline? }
          related = Mail::Part.new
          related.content_type = "multipart/related"
          mixed = [ related ]

          message.parts.each do |p|
            if p.attachment? && !p.inline?
              mixed << p
            else
              related.add_part(p)
            end
          end

          message.parts.clear
          mixed.each { |c| message.add_part(c) }
        end
      end
Register or log in to add new notes.