Validating e-mail addresses is a complicated procedure. This helper class is easy tu use and validates addresses in several ways.
- Check for valid top level domain
- Check for length and formatting
- Check for existing and valid MX entry
Get the current version from here.
<?php
require_once('MailValidation.php');
$result = new MailValidation('joe@example.com')->validate();
$result = new MailValidation()->setEmailAddress('joe@example.com')->validate();
$result = new MailValidation()->validate('joe@example.com');
$mailvalidation->setCheckDNS();
$mailvalidation->setCheckControlChars();
$mailvalidation->setCheckLength();
$mailvalidation->setCheckTopLevelDomain();
$mailvalidation->setAllowIpAsDomainPart();
$mailvalidation->getCheckDNS();
$mailvalidation->getCheckControlChars();
$mailvalidation->getCheckLength();
$mailvalidation->getCheckTopLevelDomain();
$mailvalidation->getAllowIpAsDomainPart();
The file MailValidation.tld must be writable and reside in the same directory as the MailValidation.php class file.
new Mailvalidation()->DownloadTopLevelDomains();