class Mail::Body

Attributes

content_type_with_jpmobile[RW]
mobile[RW]

Public Instance Methods

crlf_boundary() click to toggle source
crlf_boundary_with_jpmobile() click to toggle source
# 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
Also aliased as: crlf_boundary
crlf_boundary_without_jpmobile() click to toggle source
Alias for: crlf_boundary
decode_transfer_encoding() click to toggle source
# 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
decoded() click to toggle source
Also aliased as: decoded_without_jpmobile
decoded_with_jpmobile() click to toggle source
# File lib/jpmobile/mail.rb, line 361
def decoded_with_jpmobile
  decoded_without_jpmobile
end
Also aliased as: decoded
decoded_without_jpmobile() click to toggle source
Alias for: decoded
encoded(transfer_encoding = '8bit') click to toggle source
Also aliased as: encoded_without_jpmobile
encoded_with_jpmobile(transfer_encoding = '8bit') click to toggle source

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
Also aliased as: encoded
encoded_without_jpmobile(transfer_encoding = '8bit') click to toggle source
Alias for: encoded
end_boundary() click to toggle source
end_boundary_with_jpmobile() click to toggle source
# 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
Also aliased as: end_boundary
end_boundary_without_jpmobile() click to toggle source
Alias for: end_boundary
epilogue() click to toggle source
Also aliased as: epilogue_without_jpmobile
epilogue_with_jpmobile() click to toggle source
# 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
Also aliased as: epilogue
epilogue_without_jpmobile() click to toggle source
Alias for: epilogue
mobile=(m) click to toggle source
# 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
preamble() click to toggle source
Also aliased as: preamble_without_jpmobile
preamble_with_jpmobile() click to toggle source
# 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
Also aliased as: preamble
preamble_without_jpmobile() click to toggle source
Alias for: preamble
raw_source() click to toggle source
Also aliased as: raw_source_without_jpmobile
raw_source_with_jpmobile() click to toggle source
# File lib/jpmobile/mail.rb, line 336
def raw_source_with_jpmobile
  raw_source_without_jpmobile.to_crlf
end
Also aliased as: raw_source
raw_source_without_jpmobile() click to toggle source
Alias for: raw_source
set_charset() click to toggle source
Also aliased as: set_charset_without_jpmobile
set_charset_with_jpmobile() click to toggle source

fix charset

# File lib/jpmobile/mail.rb, line 366
def set_charset_with_jpmobile
  @charset ||= only_us_ascii? ? 'US-ASCII' : nil
end
Also aliased as: set_charset
set_charset_without_jpmobile() click to toggle source
Alias for: set_charset
split!(boundary) click to toggle source
# 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