Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jamesbrooks/20230 to your computer and use it in GitHub Desktop.
Save jamesbrooks/20230 to your computer and use it in GitHub Desktop.
module TMail
class Mail
def plain_text_body
gather_plain_text_parts(self).flatten
end
private
def gather_plain_text_parts(part)
returning [] do |message|
message << part.body.strip if part.content_type == 'text/plain'
part.parts.each { |p| message << gather_plain_text_parts(p) }
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment