Module: Mail::Jenc::MessagePatch
- Defined in:
- lib/mail/jenc/message_patch.rb
Instance Method Summary collapse
Instance Method Details
#add_file(values) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/mail/jenc/message_patch.rb', line 17 def add_file(values) if Jenc.enabled? if values.is_a?(Hash) values[:charset] ||= nil values[:header_charset] = header.charset if header.charset end end super end |
#body=(value) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/mail/jenc/message_patch.rb', line 6 def body=(value) if Jenc.enabled? if value.is_a?(String) && !value.ascii_only? && value.encoding == Encoding::UTF_8 && charset && charset.downcase != 'utf-8' && @transport_encoding.to_s != '8bit' value = Mail::Encodings.transcode_charset(value, value.encoding, charset) value.force_encoding('us-ascii') if @transport_encoding.to_s == '7bit' && charset.downcase == 'iso-2022-jp' value = @transport_encoding.encode(value) end end super end |
#convert_to_multipart ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/mail/jenc/message_patch.rb', line 27 def convert_to_multipart unless has_content_type? content_type = 'text/plain' content_type += "; charset=#{charset}" if charset self.content_type = content_type end super end |