Go to file
Arthur Poulet f217992c51
All checks were successful
continuous-integration/drone/push Build is passing
ci: add ci and update readme
2021-10-13 00:31:02 +02:00
spec Improve Rfc1123::Public (minor rfc fix) 2016-07-26 11:53:29 +02:00
src Update version 2017-01-11 20:48:20 +01:00
.drone.yml ci: add ci and update readme 2021-10-13 00:31:02 +02:00
.gitignore ci: add ci and update readme 2021-10-13 00:31:02 +02:00
.travis.yml initialize the project 2016-05-11 22:00:01 +02:00
LICENSE initialize the project 2016-05-11 22:00:01 +02:00
README.md ci: add ci and update readme 2021-10-13 00:31:02 +02:00
shard.yml version: improve how deps is resolved 2021-07-13 20:41:24 +02:00

A RFC compliant Email validator

Build Status

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

Prelude

Compliance

To do

  • To do : rfc 6530.
  • To do : Implement IPv6

Notes

  • No ipv6 for now
  • No escaped characters
  • Public email validity (no raw ip, domain withour root domain, ...)

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? "toto@tata.com" # => true
CrystalEmail::Rfc5322::Public.match "toto@tata.com" # => #<MatchData "toto@tata" local:"toto" domain:"tata.com">

"toto@toto.toto".is_email? # => true

Contributes !

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

  • Sceptique