class Mail::Part

def action

array of all the actions, one for each report
Either returns the action if the message has just a single report, or an
def action
  get_return_values('action')
end

def add_content_id(content_id_val = '')

It will preserve the content ID you specify if you do.

specifying a content id.
a unique content ID if you try and encode it or output it to_s without
into the Header. The ContentIdField object will automatically generate
Creates a new empty Content-ID field and inserts it in the correct order
def add_content_id(content_id_val = '')
  header['content-id'] = content_id_val
end

def add_required_fields

def add_required_fields
  super
  add_content_id if !has_content_id? && inline?
end

def add_required_message_fields

def add_required_message_fields
  # Override so we don't add Date, MIME-Version, or Message-ID.
end

def bounced?

def bounced?
  if action.is_a?(Array)
    !!(action.first =~ /failed/i)
  else
    !!(action =~ /failed/i)
  end
end

def cid

def cid
  add_content_id unless has_content_id?
  Utilities.uri_escape(Utilities.unbracket(content_id))
end

def delivery_status_data

def delivery_status_data
  delivery_status_report_part? ? parse_delivery_status_report : {}
end

def delivery_status_report_part?

def delivery_status_report_part?
  (main_type =~ /message/i && sub_type =~ /delivery-status/i) && body =~ /Status:/
end

def diagnostic_code

def diagnostic_code
  get_return_values('diagnostic-code')
end

def error_status

def error_status
  get_return_values('status')
end

def final_recipient

def final_recipient
  get_return_values('final-recipient')
end

def get_return_values(key)

def get_return_values(key)
  if delivery_status_data[key].is_a?(Array)
    delivery_status_data[key].map { |a| a.value }
  elsif !delivery_status_data[key].nil?
    delivery_status_data[key].value
  else
    nil
  end
end

def has_content_id?

not have a value, but the field exists or not.
Returns true if the part has a content ID field, the field may or may
def has_content_id?
  header.has_content_id?
end

def inline?

def inline?
  header[:content_disposition].disposition_type == 'inline' if header[:content_disposition].respond_to?(:disposition_type)
end

def parse_delivery_status_report

def parse_delivery_status_report
  @delivery_status_data ||= Header.new(body.to_s.gsub("\r\n\r\n", "\r\n"))
end

def parse_message

A part may not have a header.... so, just init a body if no header
def parse_message
  header_part, body_part = raw_source.split(/#{Constants::LAX_CRLF}#{Constants::WSP}*#{Constants::LAX_CRLF}/m, 2)
  if header_part =~ Constants::HEADER_LINE
    self.header = header_part
    self.body   = body_part
  else
    self.header = "Content-Type: text/plain\r\n"
    self.body   = raw_source
  end
end

def remote_mta

def remote_mta
  get_return_values('remote-mta')
end

def retryable?

def retryable?
  !(error_status =~ /^5/)
end

def url

def url
  "cid:#{cid}"
end