class Mail::Address

def format(output_type = :decode)

a.format #=> 'Mikel Lindsaar (My email address)'
a = Address.new('Mikel Lindsaar (My email address) ')

putting the address in angle brackets etc.
to format it correctly. This includes quoting display names as needed and
an incorrectly formatted address as input, Mail::Address will do its best
Returns a correctly formatted address for the email going out. If given
def format(output_type = :decode)
  parse unless @parsed
  if @data.nil?
    Constants::EMPTY
  elsif name = display_name(output_type)
    [Utilities.quote_phrase(name), "<#{address(output_type)}>", format_comments].compact.join(Constants::SPACE)
  elsif a = address(output_type)
    [a, format_comments].compact.join(Constants::SPACE)
  else
    raw
  end
end