def extract_from(rails_message, format: :full, source: nil)
      from = nil

      # check to see if a source is present, and if it is use the naming convention
      if source.present?
        # we'll set from here, and then fall through
        from = extract_custom(rails_message, "#{source}_from")
      end

      # if a source was specified and value found, from should already be set
      # otherwise we need to fall back to the normal from field
      from ||= rails_message[:from].formatted.first

      # try to do a complex extract on the from, and proceed from there
      from = complex_extract(from)
      return from[:value] if from[:decoded]

      case format
      when :full
        rails_message[:from].formatted.first
      when :name
        rails_message[:from].address_list.addresses.first.name
      when :address
        rails_message[:from].address_list.addresses.first.address
      end
    end
def extract_from(rails_message, format: :full, source: nil)
      from = nil

      # check to see if a source is present, and if it is use the naming convention
      if source.present?
        # we'll set from here, and then fall through
        from = extract_custom(rails_message, "#{source}_from")
      end

      # if a source was specified and value found, from should already be set
      # otherwise we need to fall back to the normal from field
      from ||= rails_message[:from].formatted.first

      # try to do a complex extract on the from, and proceed from there
      from = complex_extract(from)
      return from[:value] if from[:decoded]

      case format
      when :full
        rails_message[:from].formatted.first
      when :name
        rails_message[:from].address_list.addresses.first.name
      when :address
        rails_message[:from].address_list.addresses.first.address
      end
    end
format can be full|name|address