Skip to content

egulias/EmailValidator4Scala

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EmailValidator4Scala

Build Status Download

Simple RFC compliant EmailValidator for Scala.

Suported RFCs

5321, 5322, 6530, 6531, 6532.

Install it!

EmailValidator4Scala is available on JCenter!!! In your build.sbt file first add JCenter resolver

resolvers ++= Seq(
    "Jcenter" at "https://jcenter.bintray.com/"
)

Then add the dependency

libraryDependencies ++= Seq(
    "com.egulias" % "emailvalidator4scala_2.11" % "0.4.0"
)

Getting Started

EmailValidator for Scala is an RFC compliant email validator. Will return a Right or Left result with information about the error.

def validate(email:String): Either[Failure,Success]

(source)

A valid email

scala> import emailvalidator.EmailValidator
import emailvalidator.EmailValidator
scala> print (EmailValidator.validate("[email protected]"))
Right(Success(None))

An invalid email

scala> import emailvalidator.EmailValidator
import emailvalidator.EmailValidator
scala>   print (EmailValidator.validate("test(a)[email protected]"))
Left(Failure([1.5] failure: `AT' expected but GENERIC(a,true) found

a@example.com
    ^))

Licence

Released under the MIT License attached with this code in the LICENSE file.

About

RFC strict email validator for Scala

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages