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 9d01084 commit 190fe5180f422a9c54c35dfb6665cf58200d83d1 @tylercollier tylercollier committed with Sep 21, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/letter_opener/message.rb
@@ -51,7 +51,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 190fe51

Please sign in to comment.