Class: RMail::Address::Parser

Class | RMail::Address::Parser
In: | lib/rmail/address.rb
Parent: | Object

This class provides a facility to parse a string containing one or more RFC2822 addresses into an array of RMail::Address objects. You can use it directly, but it is more conveniently used with the RMail::Address.parse method.

### Methods

new parse

### Constants

SYM_ATOM | = | :atom
SYM_ATOM_NON_ASCII | = | :atom_non_ascii
SYM_QTEXT | = | :qtext
SYM_COMMA | = | :comma
SYM_LESS_THAN | = | :less_than
SYM_GREATER_THAN | = | :greater_than
SYM_AT_SIGN | = | :at_sign
SYM_PERIOD | = | :period
SYM_COLON | = | :colon
SYM_SEMI_COLON | = | :semi_colon
SYM_DOMAIN_LITERAL | = | :domain_literal

### Public Class methods

new(string)

Create a RMail::Address::Parser object that will parse `string`. See also the RMail::Address.parse method.

### Public Instance methods

parse()

This function attempts to extract mailing addresses from the string passed to new. The function returns an RMail::Address::List of RMail::Address objects (RMail::Address::List is a subclass of Array). A malformed input string will not generate an exception. Instead, the array returned will simply not contained the malformed addresses.

The string is expected to be in a valid format as documented in RFC2822‘s mailbox-list grammar. This will work for lists of addresses in the `To:`, `From:`, etc. headers in email.

[Validate]