Jump to content

windows php mail validation


monty 187
 Share

Recommended Posts

<html><body><?php	$email="fulmont99@gmail.com";        $pattern = '/^[A-z0-9_\-\.]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{2,4}$/';        if (!preg_match($pattern, $email))        {	echo "The mail is not valid";	}		else	{            list($Username, $Domain) = split("@",$email);          if(getmxrr($Domain, $MXHost))           {             echo "The mail is valid";          }          else           {             if(fsockopen($Domain, 25, $errno, $errstr, 30))              {             echo "The mail is valid";             }          else           {             echo "The mail is not valid";          }        }}        echo "    $email";?></body></html>

Hi all, im am working on a mail validation test program. It appears to be working up until if(getmxrr($Domain, $MXHost)) ; i have read on goolge that this happens when the script is run on a windows server!The error is:Fatal error: Call to undefined function: getmxrr() in D:\hshome\nigel\pmigroup.ie\cp\Scripts\PHP\testmail.php on line 20Anyone any idea how to get around this to ensure the domain is correct in the email?Thanks

Link to comment
Share on other sites

Note: This function is not implemented on Windows platforms. Try the PEAR class Net_DNS.
http://pear.php.net/package/Net_DNSIf you are going to host this on a Linux machine, then you probably don't need to worry about the error for now. If you have a Windows host, you will need to use something else.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...