From 5642614492f0ca2064c01d60cc33284cc2f731a9 Mon Sep 17 00:00:00 2001 From: Sebastiaan Provost Date: Fri, 3 Feb 2017 23:48:59 +0100 Subject: [PATCH] Backporting the changes made in #139 (#140) * Backporting the changes made in https://github.com/egulias/EmailValidator/pull/139 so this functionality is also accessible in the 1.2.x releases. This fix allows for more compliance with the DNS RFC. Explanation here: https://github.com/egulias/EmailValidator/pull/139/commits/08bac068c26edd210daa259a2819d7dfd7438091 --- src/Egulias/EmailValidator/EmailValidator.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Egulias/EmailValidator/EmailValidator.php b/src/Egulias/EmailValidator/EmailValidator.php index 4325dd7..69ff5fc 100644 --- a/src/Egulias/EmailValidator/EmailValidator.php +++ b/src/Egulias/EmailValidator/EmailValidator.php @@ -184,7 +184,10 @@ public function getThreshold() */ protected function checkDNS() { - $mxRecordExists = checkdnsrr(trim($this->parser->getParsedDomainPart()), 'MX'); + $host = $this->parser->getParsedDomainPart(); + $host = rtrim($host, '.') . '.'; + + $mxRecordExists = checkdnsrr($host, 'MX'); if (!$mxRecordExists) { $this->warnings[] = self::DNSWARN_NO_RECORD;