wiecklabs / rfc822

RFC822 Email Parser / Validator

This URL has Read+Write access

Sun Oct 11 10:29:59 -0700 2009
commit  6548761f7670692a83d0275d0b4ccbf90873d1ee
tree    3f348700c50c91b0ce09f564b2428e54e7417ef5
parent  ea0e0fd45bd9db39638f795d0f111e732dea554b
rfc822 /
name age message
file .gitignore Loading commit data...
file README
file Rakefile
directory lib/
directory test/
README
RFC822
======

Presently, the sole purpose of this gem is to parse and validate email
addresses according to the spec (except where it makes most sense to
deviate).

USAGE
=====

To parse and validate a single email address, use RFC822::Address.build

  require "rfc822"
  email = RFC822::Address.build("john+nospam@example.com")
  email.address # => "john+nospam@example.com"
  email.valid? # => true

Display names in email addresses are also fully supported:

  email = RFC822::Address.build('"John Doe, III" <john@example.com>')
  email.name # => "John Doe, III"
  email.to_s # => "\"John Doe, III\" <john@example.com>"

To parse and validate a list of email addresses, use RFC822::Address.parse.
Addresses can be separated by commas or newlines.

  emails = RFC822::Address.parse("john@example.com, jane@example.com")
  emails.size # => 2
  emails[1].address # => "jane@example.com"