note 10675 modified in function.getmxrr by felipe
| From: | felipe@php.net | Date: | Tue, 22 Jul 2008 03:04:42 +0000 |
| Subject: | note 10675 modified in function.getmxrr by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142479@lists.php.net to get a copy of this message | ||
Prevent your dns server from 'creating' a valid host name by appending the local domain to
incomplete emails by appending to the domain a trailing . both in the pattern match and mx checks:
<?php
if (eregi("^[0-9a-z_]([-_.]?[0-9a-z])*@[0-9a-z][-.0-9a-z]*\\.[a-z]{2,3}[.]?$", $string,
$check)) {
$host = substr(strstr($check[0], '@'), 1).".";
if ( getmxrr($host, $validate_email_temp) )
return TRUE;
// THIS WILL CATCH DNSs THAT ARE NOT MX.
if(checkdnsrr($host,"ANY"))
return TRUE;
}
?>
--was--
Prevent your dns server from 'creating' a valid host name by appending the local domain to
incomplete emails by appending to the domain a trailing . both in the pattern match and mx checks:
if (eregi("^[0-9a-z_]([-_.]?[0-9a-z])*@[0-9a-z][-.0-9a-z]*\\.[a-z]{2,3}[.]?$", $string,
$check)) {
$host = substr(strstr($check[0], '@'), 1).".";
if ( getmxrr($host, $validate_email_temp) )
return TRUE;
// THIS WILL CATCH DNSs THAT ARE NOT MX.
if(checkdnsrr($host,"ANY"))
return TRUE;
}
return FALSE;
http://php.net/manual/en/function.getmxrr.php