v3.2.8 -
Show latest stable
-
3 notes
- 1.0.0 (0)
- 1.1.6 (0)
- 1.2.6 (0)
- 2.0.3 (0)
- 2.1.0 (0)
- 2.2.1 (0)
- 2.3.8 (0)
- 3.0.0 (0)
- 3.0.9 (0)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (0)
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (0)
- 5.1.7 (0)
- 5.2.3 (1)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (38)
- 7.1.3.4 (0)
- 7.2.3 (0)
- 8.0.0 (0)
- 8.1.1 (0)
- What's this?
Register or
log in
to add new notes.
schapht -
July 8, 2008
schapht -
July 8, 2008
james -
July 24, 2008 - (v1.0.0 - v2.1.0)
4 thanks
For more information
See Base class.
3 thanks
For more information
See ActiveMailer::Base.
0 thanks
Extract plain text body from TMail parsed email
Here’s a monkey patch for TMail::Mail I wrote to recurse through a message and extract all plain text body components of that message, returning an Array. For most use cases, the resulting Array will contain one String element.
Currently I put this code in a file called lib/tmail_extensions.rb and require ‘tmail_extensions’ in environment.rb
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

