Module: MailReceiver::BodyParser

Included in:
Receiver
Defined in:
lib/mail-receiver/body_parser.rb

Overview

Mail body context parser

Instance Method Summary collapse

Instance Method Details

#extractObject



4
5
6
7
8
9
# File 'lib/mail-receiver/body_parser.rb', line 4

def extract
  EmailReplyParser.read(part.to_s)
    .fragments.map(&:to_s)
    .join("\n").rstrip
    .force_encoding('utf-8')
end

#partObject



11
12
13
# File 'lib/mail-receiver/body_parser.rb', line 11

def part
  mail.multipart? ? mail.parts.first.body : mail.body
end