A modern and lightweight library for working with email addresses in Java
requireValidMXRecord()
validation rule now correctly fails validation for domains that use a "Null MX" record. (Thanks @elmolm for contributing! 🎉)-
character now correctly fail validation with the reason FailureReason.DOMAIN_PART_ENDS_WITH_DASH
instead of incorrectly returning FailureReason.ENDS_WITH_DOT
. (Thanks @tbatchlear for reporting!)requireAscii()
that considers an email address containing non-ASCII characters to be invalid. (Thanks @frodeto for suggesting!)isAscii()
on Email
objects that returns if the email address only contains ASCII characters or not.normalize()
method. (Thanks @tdelaney-leadiro for suggesting!)
true
. Example: email.normalize(true)
-Djmail.normalize.strip.quotes=true
JVM property at runtime, and continue to use the normalize()
method without parameters.requireValidMXRecord(int initialTimeout, int numRetries)
that allows for customization of the timeout for DNS lookups. (Thanks @dotneutron for suggesting!)requireValidMXRecord()
rule to an EmailValidator
from potentially taking a maximum of 25 seconds to a maximum of 600 milliseconds.validate(String email)
that returns an EmailValidationResult
object, containing the reason for validation failure upon failure. (Thanks @bobharner for suggesting!)ValidationRule
requireValidMXRecord()
to consider email addresses that have a domain with no MX record in DNS as invalid. (Thanks @lpellegr for suggesting!)[email protected](comment
ValidationRule
disallowObsoleteWhitespace()
to consider email addresses with obsolete whitespace as invalid. (Thanks @PascalSchumacher for suggesting!)normalized()
method on the Email
class to provide a way to get a "normalized" version of an email address (the address without any comments or optional parts).IllegalArgumentException
instead of returning false. (Thanks @PascalSchumacher for reporting!)equals()
and hashCode()
methods for Email
and TopLevelDomain