Permalink
Browse files

Added ":text_part_charset" option for multi part mail.

  • Loading branch information...
1 parent b57a33c commit 42dac2818771536a7999000597dcf339a1920736 @yoshuki yoshuki committed Jun 2, 2011
Showing with 9 additions and 0 deletions.
  1. +4 −0 lib/pony.rb
  2. +5 −0 spec/pony_spec.rb
View
@@ -219,6 +219,10 @@ def self.build_mail(options)
mail.charset = options[:charset] if options[:charset] # charset must be set after setting content_type
+ if mail.multipart? && options[:text_part_charset]
+ mail.text_part.charset = options[:text_part_charset]
+ end
+
mail
end
View
@@ -82,6 +82,11 @@
mail.charset.should == 'UTF-8'
end
+ it "text_part_charset" do
+ mail = Pony.build_mail(:attachments => {"foo.txt" => "content of foo.txt"}, :body => 'test', :text_part_charset => 'ISO-2022-JP')
+ mail.text_part.charset.should == 'ISO-2022-JP'
+ end
+
it "default charset" do
Pony.build_mail(:body => 'body').charset.should == 'UTF-8'
Pony.build_mail(:body => 'body', :content_type => 'text/html').charset.should == 'UTF-8'

0 comments on commit 42dac28

Please sign in to comment.