Rumor has it... one can ping an email server to test if an email is REAL.

For years we have actually sent email... and processed all the 'user unknown/over quota etc... ' BUT surly there must be a way to bounce a test off of an email server without having to actually send the email...

Any thoughts/ or links would be much appreciated.

    One way to do it is to check for MX records -

    function checkmail ($s) {
    	$emailcmpstr = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM-.@_1234567890";
    	$host = substr ($s, strrpos($s, '@') + 1, strlen($s) - strrpos($s, '@'));
    
    if (strspn ($s, $emailcmpstr) != strlen($s)) {return false;}
    if (!checkdnsrr ($host, "MX")) {
    	$host_array=explode(".",$host);
    	$host=$host_array[sizeof($host_array)-2].".".$host_array[sizeof($host_array)-1];
    	if (!checkdnsrr ($host, "MX")) {
    		return false;
    		}
    	}
    return true;
    }

    Hope this helps 😉

    P.S. Note the dns checking functions do not work on windows

      why not

      $emailcmpstr = "[a-zA-Z0-9_-]";

      It may need changing but its alot easier than what you have

        Write a Reply...