This class provides the following functionality:
|Classes and Modules|
|Public Class methods|
|new(string = nil)|
Create a new address. If the string argument is not nil, it is parsed for mail addresses and if one is found, it is used to initialize this object.
This is identical to using a RMail::Address::Parser directly like this:
|Public Instance methods|
Compare this address with another based on the email address portion only (any display name and comments are ignored). If the other object is not an RMail::Address, it is coerced into a string with its to_str method and then parsed into an RMail::Address object.
Return a hash value for this address. This is based solely on the email address portion (any display name and comments are ignored).
Return true if the two objects are equal. Do this based solely on the email address portion (any display name and comments are ignored). Fails if the other object is not an RMail::Address object.
Retrieve the local portion of the mail address. This is the portion that precedes the @ sign.
Assign the local portion of the mail address. This is the portion that precedes the @ sign.
Returns the display name of this address. The display name is present only for "angle addr" style addresses such as:
John Doe <firstname.lastname@example.org>
In this case, the display name will be "John Doe". In particular this old style address has no display name:
email@example.com (Bob Smith)
Assign a display name to this address. See display_name for a definition of what this is.
See also display_name
Returns a best guess at a display name for this email address. This function first checks if the address has a true display name (see display_name) and returns it if so. Otherwise, if the address has any comments, the last comment will be returned.
In most cases, this will behave reasonably. For example, it will return "Bob Smith" for this address:
firstname.lastname@example.org (Bob Smith)
Returns the comments in this address as an array of strings.
Set the comments for this address. The comments argument can be a string, or an array of strings. In either case, any existing comments are replaced.
Retrieve to the domain portion of the mail address. This is the portion after the @ sign.
Assign a domain name to this address. This is the portion after the @ sign. Any existing domain name will be changed.
Returns the email address portion of the address (i.e. without a display name, angle addresses, or comments).
The string returned is not suitable for insertion into an e-mail. RFC2822 quoting rules are not followed. The raw address is returned instead.
For example, if the local part requires quoting, this function will not perform the quoting (see #format for that). So this function can returns strings such as:
"address with no email@example.com"
See also #format
Return this address as a String formated as appropriate for insertion into a mail message.
Alias for #format