class EmailReplyParser

EmailReplyParser is a small library to parse plain text email content. The goal is to identify which fragments are quoted, part of a signature, or original body content. We want to support both top and bottom posters, so no simple “REPLY ABOVE HERE” content is used.

Beyond RFC 5322 (which is handled by the [Ruby mail gem]), there aren't any real standards for how emails are created. This attempts to parse out common conventions for things like replies:

this is some text

On <date>, <author> wrote:
> blah blah
> blah blah

… and signatures:

this is some text

--
Bob
http://homepage.com/~bob

Each of these are parsed into Fragment objects.

EmailReplyParser also attempts to figure out which of these blocks should be hidden from users.

[mail]: github.com/mikel/mail

Constants

VERSION

Public Class Methods

parse_reply(text) click to toggle source

Public: Get the text of the visible portions of the given email body.

text - A String email body.

Returns a String.

# File lib/email_reply_parser.rb, line 49
def self.parse_reply(text)
  self.read(text).visible_text
end
read(text) click to toggle source

Public: Splits an email body into a list of Fragments.

text - A String email body.

Returns an Email instance.

# File lib/email_reply_parser.rb, line 40
def self.read(text)
  Email.new.read(text)
end