code: def folded_parts(parts)
        return folded_parts([parts]) unless parts.respond_to?(:each)
  
        result = [] # NOTE could use #tap but want 1.8.7 compat
        parts.each do |part|
          result << (part.multipart? ? folded_parts(part.parts) : part)
        end
        result.flatten
      end
docs: Helper to fold all the parts of multipart mail down into a flat array.
   multipart/related and multipart/alternative parts can have child parts.