Re: QuickForm - E-Mail validation with checkdnsrr() - subdomains
| From: | Markus Ernst | Date: | Thu, 11 Feb 2010 13:15:05 +0000 |
| Subject: | Re: QuickForm - E-Mail validation with checkdnsrr() - subdomains | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-30284@lists.php.net to get a copy of this message | ||
Ken Guest schrieb:
On Thu, Feb 11, 2010 at 11:15 AM, Markus Ernst <derernst@gmx.ch> wrote:This package does the exact same thing - these are the lines 581 to 587 of validate.php: if ($check_domain && function_exists('checkdnsrr')) {Mark Steudel schrieb:You could use the Validate package to determine whether an email address is valid. http://pear.php.net/manual/en/package.validate.validate.email.phpSomething else to try would be to test the subdomain with the checkdnsrr function outside of that email function. Depending on how DNS is setup, it's possible that the subdomain isn't actually an A record but a CNAME and is therefore returning false. If you look at the two checks, it only checks that it's a MX record or A record ...Thank you for this hint. I now tried checkdnsrr($domain, "CNAME"), which returned false for both main domain and sub domain, and checkdnsrr($domain) without the type argument, which behaves the same as checking with "MX" and "A" type arguments. It looks like in this special case, mails to addresses *@subdomain.maindomain.tld are handled internally by the server at maindomain.tld, without any handling at DNS level.
$domain = preg_replace('/[^-a-z.0-9]/i', '', array_pop(explode('@', $email)));
if (checkdnsrr($domain, 'MX') || checkdnsrr($domain, 'A')) {
return true;
}
return false;
}
So, my original question applies there, too :-)