Skip to content

Commit

Permalink
Set the charset in email preview
Browse files Browse the repository at this point in the history
  • Loading branch information
nono committed Sep 7, 2011
1 parent 2b19f1c commit 79deac1
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 79deac1

Please sign in to comment.