Module: LetterThief::ApplicationHelper

Defined in:
app/helpers/letter_thief/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#parsed_body_html(email) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/letter_thief/application_helper.rb', line 3

def parsed_body_html(email)
  rendered = email.body_html
  email.attachments.each do |attachment|
    puts attachment.blob.["cid"]
    rendered.gsub!("cid:#{attachment.blob.["cid"]}", main_app.rails_blob_path(attachment))
  end
  # autolinking can be implemented for text bodies
  # rendered.gsub!(URI::Parser.new.make_regexp(%W[https http])) do |link|
  #   "<a href=\"#{ link }\">#{ link }</a>"
  # end
  rendered
end