Athena::MIME::Address
Represents an email address with an optional name.
Constructors
Class methods
Creates an array of AMIME::Address from the provided enumerable addresses.
AMIME::Address.create_multiple({"me@example.com", "Mr Smith <smith@example.com>", AMIME::Address.new("you@example.com")}) # =>
# [
# Athena::MIME::Address(@address="me@example.com", @name=""),
# Athena::MIME::Address(@address="smith@example.com", @name="Mr Smith"),
# Athena::MIME::Address(@address="you@example.com", @name=""),
# ]
Creates an array of AMIME::Address from the provided addresses.
AMIME::Address.create_multiple "me@example.com", "Mr Smith <smith@example.com>", AMIME::Address.new("you@example.com") # =>
# [
# Athena::MIME::Address(@address="me@example.com", @name=""),
# Athena::MIME::Address(@address="smith@example.com", @name="Mr Smith"),
# Athena::MIME::Address(@address="you@example.com", @name=""),
# ]
Instance methods
address
Returns the raw email address portion of this Address.
Use #encoded_address to get a safe representation for use in a MIME header.
address = AMIME::Address.new "first.last@example.com", "First Last"
address.address # => "first.last@example.com"
encoded_address
Returns an encoded representation of #address safe to use within a MIME header.
AMIME::Address.new("contact@athenï.org").encoded_address # => "xn--athen-gta.org"
encoded_name
Returns an encoded representation of #name safe to use within a MIME header.
AMIME::Address.new("us@example.com", %(Me, "You)).encoded_name # => "Me, \"You"
has_unicode_local_part?
Returns true if this Address's localpart contains at least one non-ASCII character.
Otherwise returns false.
AMIME::Address.new("info@dømi.com").has_unicode_local_part? # => false
AMIME::Address.new("dømi@dømi.com").has_unicode_local_part? # => true
name
Returns the raw name portion of this Address, or an empty string if none was set.
Use #encoded_name to get a safe representation for use in a MIME header.
address = AMIME::Address.new "first.last@example.com"
address.name # => ""
address = AMIME::Address.new "first.last@example.com", "First Last"
address.name # => "First Last"