# File lib/jpmobile/mail.rb, line 408 def crlf_boundary_with_jpmobile if @mobile Jpmobile::Util.encode(crlf_boundary_without_jpmobile, @mobile.mail_charset(@charset)) else crlf_boundary_without_jpmobile end end
# File lib/jpmobile/mail.rb, line 386 def decode_transfer_encoding _raw_source = Jpmobile::Util.decode(@raw_source, self.encoding, @charset) @raw_source = @mobile.decode_transfer_encoding(_raw_source, @charset) self.encoding = 'text' end
# File lib/jpmobile/mail.rb, line 361 def decoded_with_jpmobile decoded_without_jpmobile end
convert encoding
# File lib/jpmobile/mail.rb, line 341 def encoded_with_jpmobile(transfer_encoding = '8bit') if @mobile and !multipart? case transfer_encoding when /base64/ _raw_source = if transfer_encoding == encoding @raw_source.dup else get_best_encoding(transfer_encoding).encode(@raw_source) end Jpmobile::Util.set_encoding(_raw_source, @mobile.mail_charset(@charset)) when /quoted-printable/ Jpmobile::Util.set_encoding([@mobile.to_mail_body(@raw_source)].pack("M").gsub(/\n/, "\r\n"), @mobile.mail_charset(@charset)) else @mobile.to_mail_body(Jpmobile::Util.force_encode(@raw_source, nil, Jpmobile::Util::UTF8)) end else encoded_without_jpmobile(transfer_encoding) end end
# File lib/jpmobile/mail.rb, line 416 def end_boundary_with_jpmobile if @mobile Jpmobile::Util.encode(end_boundary_without_jpmobile, @mobile.mail_charset(@charset)) else end_boundary_without_jpmobile end end
# File lib/jpmobile/mail.rb, line 400 def epilogue_with_jpmobile if @mobile Jpmobile::Util.encode(@epilogue, @mobile.mail_charset(@charset)) else epilogue_without_jpmobile end end
# File lib/jpmobile/mail.rb, line 370 def mobile=(m) @mobile = m if ["base64", "quoted-printable"].include?(self.encoding) and /text/.match(self.content_type_with_jpmobile) self.decode_transfer_encoding end if self.multipart? and @mobile self.parts.each do |part| part.mobile = @mobile part.body.mobile = @mobile end end end
# File lib/jpmobile/mail.rb, line 392 def preamble_with_jpmobile if @mobile Jpmobile::Util.encode(@preamble, @mobile.mail_charset(@charset)) else preamble_without_jpmobile end end
# File lib/jpmobile/mail.rb, line 336 def raw_source_with_jpmobile raw_source_without_jpmobile.to_crlf end
fix charset
# File lib/jpmobile/mail.rb, line 366 def set_charset_with_jpmobile @charset ||= only_us_ascii? ? 'US-ASCII' : nil end
# File lib/jpmobile/mail.rb, line 448 def split!(boundary) self.boundary = boundary parts = raw_source.split(/(?:\A|\r\n)--#{Regexp.escape(boundary)}(?=(?:--)?\s*$)/) # Make the preamble equal to the preamble (if any) self.preamble = parts[0].to_s.strip # Make the epilogue equal to the epilogue (if any) self.epilogue = parts[-1].to_s.sub('--', '').strip parts[1...-1].to_a.each { |part| @parts << Mail::Part.new(:body_raw => part, :mobile => @mobile) } self end