Skip to content

Latest commit

 

History

History
66 lines (48 loc) · 1.91 KB

README.md

File metadata and controls

66 lines (48 loc) · 1.91 KB

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.