Class: EmlToPdf::Email

Inherits:
Object
  • Object
show all
Defined in:
lib/eml_to_pdf/email.rb

Constant Summary collapse

MIME_TYPES =
{
  plain_text: "text/plain",
  html: "text/html",
  multipart_alternative: "multipart/alternative"
}
TEMPLATES_PATH =
Pathname.new(File.expand_path(__dir__)) + "templates"

Instance Method Summary collapse

Constructor Details

#initialize(input_path) ⇒ Email

Returns a new instance of Email.



16
17
18
19
# File 'lib/eml_to_pdf/email.rb', line 16

def initialize(input_path)
  @input_path = input_path
  @mail = Mail.read(input_path)
end

Instance Method Details

#to_htmlObject



21
22
23
24
25
26
# File 'lib/eml_to_pdf/email.rb', line 21

def to_html
  html = text_parts(@mail).join
  html = resolve_cids_from_attachments(html, @mail.all_parts)
  html = (@mail, html)
  html
end