Class: Mail::Part

Inherits:
Object
  • Object
show all
Defined in:
lib/jpmobile/mail.rb

Instance Method Summary collapse

Instance Method Details

#init_with_string(string) ⇒ Object


267
268
269
270
271
272
# File 'lib/jpmobile/mail.rb', line 267

def init_with_string(string)
  self.raw_source = string
  set_envelope_header
  parse_message
  @separate_parts = multipart?
end

#parse_message_with_jpmobileObject Also known as: parse_message


274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/jpmobile/mail.rb', line 274

def parse_message_with_jpmobile
  header_part, body_part = raw_source.split(/#{CRLF}#{WSP}*#{CRLF}/m, 2)

  if header_part =~ HEADER_LINE
    self.header = header_part
  else
    self.header = "Content-Type: text/plain\r\n"
  end

  @body_part_jpmobile = body_part
  convert_encoding_jpmobile
  body_part = @body_part_jpmobile
  self.body   = body_part
end