A RFC compliant Email validator

Build Status

Migrated to https://git.sceptique.eu/Sceptique/CrystalEmail

Prelude

Compliance

To do

Notes

Installation

Tested with crystal 0.17 - 1.1.0

Add this to your application's shard.yml:

dependencies:
  CrystalEmail:
      git: https://git.sceptique.eu/Sceptique/CrystalEmail
      branch: master

Usage in Crystal

require "CrystalEmail"

# Pure Rfc5322
# this is what you want if you need to allow local domains
CrystalEmail::Rfc5322.validates? "toto@tata" # => true
CrystalEmail::Rfc5322.match "toto@tata" # => #<MatchData "toto@tata" local:"toto" domain:"tata">
CrystalEmail::Rfc5322.validates? "toto" # => false
CrystalEmail::Rfc5322.match "toto" # => nil

# Rfc5322 + Internet basic usage
# most of the website on internet will require a domain like "domain.thing"
CrystalEmail::Rfc5322::Public.validates? "[email protected]" # => true
CrystalEmail::Rfc5322::Public.match "[email protected]" # => #<MatchData "toto@tata" local:"toto" domain:"tata.com">

"[email protected]".is_email? # => true

Contributes !

Find a bug ? Want a new feature ? Create a clear pull request and we'll see :)