class Mail::ReceivedElement

:nodoc:

def datetime_for(received)

def datetime_for(received)
  ::DateTime.parse("#{received.date} #{received.time}")
rescue ArgumentError => e
  raise e unless e.message == 'invalid date'
  warn "WARNING: Invalid date field for received element (#{received.date} #{received.time}): #{e.class}: #{e.message}"
  nil
end

def initialize(string)

def initialize(string)
  if Utilities.blank? string
    @date_time = nil
    @info = nil
  else
    received = Mail::Parsers::ReceivedParser.parse(string)
    @date_time = datetime_for(received)
    @info = received.info
  end
end

def to_s(*args)

def to_s(*args)
  "#{info}; #{date_time.to_s(*args)}"
end