alpine Posted November 25, 2006 Share Posted November 25, 2006 Being tired of bogus email-signups i'm thinking of doing a real-host check in some of my services.Just to be clear, this isn't about checking valid email format (i check for that already) but rather a lookup function to verify a real and working host.After reading back and forth in the manual i sticked on this example: http://no2.php.net/manual/en/function.getmxrr.php#64117Seems to be running ok in most cases but i still cannot get a true result from it on a few norwegian hostnames i test it against.Anyone that has already wandered these wods that can give me the path to an ok solution on this issue ? Quote Link to comment Share on other sites More sharing options...
mainewoods Posted November 26, 2006 Share Posted November 26, 2006 this is what I use, dont know if it has a problem with norwegian sites:[code]function isemailvalid($emailaddr) { //tests for valid email address if( (!preg_match('/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/', $emailaddr)) && (!preg_match('/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3}) (\]?)$/', $emailaddr)) ) { return FALSE; } list($mailusername, $mailDomain) = split("@", $emailaddr); if(checkdnsrr($mailDomain, 'MX') ) return TRUE; if(checkdnsrr($mailDomain, 'A') ) return TRUE; if(checkdnsrr($mailDomain, 'CNAME') ) return TRUE; return FALSE;} [/code] Quote Link to comment Share on other sites More sharing options...
alpine Posted November 26, 2006 Author Share Posted November 26, 2006 Thanks mainewoods,It seems to have issues (false) on some hostnames, but if i check on all types (A, MX, NS, SOA, PTR, CNAME, AAAA, A6, SRV, NAPTR, ANY) it works on all tested adresses.Seems that checkdnsrr perhaps is the way to settle with this for now. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.