class Mail::Message

def method_missing(name, *args, &block)

mail.resent_msg_id #=> '<4567@resent_msg_id.lindsaar.net>'
mail.resent_msg_id '<4567@resent_msg_id.lindsaar.net>'

mail.resent_msg_id #=> '<1234@resent_msg_id.lindsaar.net>'
mail.resent_msg_id = '<1234@resent_msg_id.lindsaar.net>'


mail.date.to_s #=> 'Tue, 1 Jul 2003 10:52:37 +0200'
mail.date 'Tue, 1 Jul 2003 10:52:37 +0200'

mail.date.to_s #=> 'Tue, 1 Jul 2003 10:52:37 +0200'
mail.date = 'Tue, 1 Jul 2003 10:52:37 +0200'


mail.comments #=> 'These are other comments'
mail.comments 'These are other comments'

mail.comments #=> 'These are some comments'
mail.comments = 'These are some comments'

Examples:

and explicitly set with the = operator
This method provides all three types of header call to set, read

a message object and interpret it as a header.
be a field name, so we don't want to just catch ANYTHING sent to
as per RFC 2822, any ruby string or method name could pretty much

Mail::Field::KNOWN_FIELDS

This will only catch the known fields listed in:

call to method missing.
own method for ease of documentation and also to avoid the hook
Those fields used most often (to, subject et al) are given their

standard fields directly as you would the "to", "subject" etc.
Method Missing in this implementation allows you to set any of the
def method_missing(name, *args, &block)
  #:nodoc:
  # Only take the structured fields, as we could take _anything_ really
  # as it could become an optional field... "but therin lies the dark side"
  field_name = Utilities.underscoreize(name).chomp("=")
  if Mail::Field::KNOWN_FIELDS.include?(field_name)
    if args.empty?
      header[field_name]
    else
      header[field_name] = args.first
    end
  else
    super # otherwise pass it on
  end
  #:startdoc:
end