Permalink
Browse files

Regexp replacement of inline attachment urls with relative path, so t…

…hat e.g. images will shown in html body
  • Loading branch information...
1 parent 3973b99 commit 25d9463f774b5cfc78d326261789b6fb5538b10e @tylercollier tylercollier committed Sep 21, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/letter_opener/message.rb
@@ -42,7 +42,14 @@ def content_type
end
def body
- @body ||= (@part && @part.body || @mail.body).to_s
+ if !@body_string
+ @body_string = (@part && @part.body || @mail.body).to_s
+ mail.attachments.each do |attachment|
+ @body_string.gsub!(attachment.url, "attachments/#{attachment.filename}")
+ end
+ @body = @body_string
+ end
+ @body
end
def from

0 comments on commit 25d9463

Please sign in to comment.