Simple RFC compliant EmailValidator for Scala.
Suported RFCs
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"
)
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)
scala> import emailvalidator.EmailValidator
import emailvalidator.EmailValidator
scala> print (EmailValidator.validate("[email protected]"))
Right(Success(None))
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
^))
Released under the MIT License attached with this code in the LICENSE file.