Permalink
Browse files

Use mail's text_part and html_part methods to avoid rendering attachm…

…ents as plain text
  • Loading branch information...
1 parent 41eb3c6 commit 5fb8ebf9ba18d5a31c05359cd3bd6dc20340f1b2 @davidcornu committed May 10, 2012
Showing with 3 additions and 4 deletions.
  1. +0 −3 lib/letter_opener/message.html.erb
  2. +3 −1 lib/letter_opener/message.rb
@@ -47,13 +47,10 @@
padding: 10px;
word-wrap: break-word;
}
-<<<<<<< HEAD
-=======
body {
margin-top: 100px !important;
}
->>>>>>> Turns out there was a good reason for that
</style>
<div id="message_headers">
@@ -3,7 +3,9 @@ class Message
attr_reader :mail
def self.rendered_messages(location, mail)
- messages = mail.parts.map { |part| new(location, mail, part) }
+ messages = []
+ messages << new(location, mail, mail.html_part) if mail.html_part
+ messages << new(location, mail, mail.text_part) if mail.text_part
messages << new(location, mail) if messages.empty?
messages.each(&:render)
messages.sort

0 comments on commit 5fb8ebf

Please sign in to comment.