Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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