Magento Fix – Email Validation for New gTLDs

Have you come across the following errors in Magento?

  • Invalid email address “[email protected]
  • [email protected]” is not a valid hostname.
  • ‘domain.events’ appears to be a DNS hostname but cannot match TLD against known list
  • ‘domain.events’ appears to be a local network name but local network names are not allowed

It is probably because the Zend email validation library is not uptodate with all the new gTLDs that are being released.

Copy
/lib/Zend/Validate/Hostname.php
to
/app/code/local/Zend/Validate/Hostname.php

Navigate to line 539 and comment out the following lines of code. This is where the domain name is checked against an array of validTlds.

[php]
if (!in_array($this->_tld, $this->_validTlds)) {
// $this->_error(self::UNKNOWN_TLD);
// $status = false;
// break;
}
[/php]

The alternative is to add all possible TLDs into the validTlds array. I prefer the above method as I do not have to keep updating the validTlds array with hundreds of new gTLDs.