Skip to content

Commit

Permalink
Merge pull request ryanb#3 from nono/encoding
Browse files Browse the repository at this point in the history
Set the charset in email preview
  • Loading branch information
ryanb committed Sep 7, 2011
2 parents 2b19f1c + 79deac1 commit f78ad39
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/letter_opener/message.html.erb
@@ -1,3 +1,5 @@
<meta http-equiv="Content-Type" content="text/html; charset=<%= encoding %>">

<style type="text/css">
#message_headers {
position: absolute;
Expand Down
6 changes: 5 additions & 1 deletion lib/letter_opener/message.rb
Expand Up @@ -28,11 +28,15 @@ def content_type
end

def body
(@part && @part.body || @mail.body).to_s
@body ||= (@part && @part.body || @mail.body).to_s
end

def type
content_type =~ /html/ ? "rich" : "plain"
end

def encoding
body.respond_to?(:encoding) ? body.encoding : "utf-8"
end
end
end

0 comments on commit f78ad39

Please sign in to comment.