wiecklabs / rfc822
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (1)
- Wiki (1)
- Graphs
-
Tree:
6548761
commit 6548761f7670692a83d0275d0b4ccbf90873d1ee
tree 3f348700c50c91b0ce09f564b2428e54e7417ef5
parent ea0e0fd45bd9db39638f795d0f111e732dea554b
tree 3f348700c50c91b0ce09f564b2428e54e7417ef5
parent ea0e0fd45bd9db39638f795d0f111e732dea554b
rfc822 /
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"
