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



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

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



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

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

  self.header = if header_part && header_part.match(Constants::HEADER_LINE)
                  header_part
                else
                  "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