Location: PHPKode > scripts > E-mail address validation class > e-mail-address-validation-class/test_email_validation.php
 * test_email_validation.html
 * @(#) $Header: /home/mlemos/cvsroot/emailvalidation/test_email_validation.php,v 1.11 2003/12/12 15:25:52 mlemos Exp $

<TITLE>Test for Manuel Lemos's PHP E-mail validation class</TITLE>
<H1><CENTER>Test for Manuel Lemos's PHP E-mail validation class</CENTER></H1>

	$validator=new email_validation_class;

	 * If you are running under Windows or any other platform that does not
	 * have enabled the MX resolution function GetMXRR() , you need to
	 * include code that emulates that function so the class knows which
	 * SMTP server it should connect to verify if the specified address is
	 * valid.
		 * If possible specify in this array the address of at least on local
		 * DNS that may be queried from your network.
	 * If GetMXRR function is available but it is not functional, you may
	 * use a replacement function.

	/* how many seconds to wait before each attempt to connect to the
	   destination e-mail server */

	/* how many seconds to wait for data exchanged with the server.
	   set to a non zero value if the data timeout will be different
		 than the connection timeout. */

	/* user part of the e-mail address of the sending user
	   (hide@address.com in this example) */

	/* domain part of the e-mail address of the sending user */

	/* Set to 1 if you want to output of the dialog with the
	   destination mail server */

	/* Set to 1 if you want the debug output to be formatted to be
	displayed properly in a HTML page. */

	/* When it is not possible to resolve the e-mail address of
	   destination server (MX record) eventually because the domain is
	   invalid, this class tries to resolve the domain address (A
	   record). If it fails, usually the resolver library assumes that
	   could be because the specified domain is just the subdomain
	   part. So, it appends the local default domain and tries to
	   resolve the resulting domain. It may happen that the local DNS
	   has an * for the A record, so any sub-domain is resolved to some
	   local IP address. This  prevents the class from figuring if the
	   specified e-mail address domain is valid. To avoid this problem,
	   just specify in this variable the local address that the
	   resolver library would return with gethostbyname() function for
	   invalid global domains that would be confused with valid local
	   domains. Here it can be either the domain name or its IP address. */

	&& strcmp($email,""))
			echo "<H2><CENTER>It was not possible to determine if <TT>$email</TT> is a valid deliverable e-mail box address.</CENTER></H2>\n";
			echo "<H2><CENTER><TT>$email</TT> is ".($result ? "" : "not ")."a valid deliverable e-mail box address.</CENTER></H2>\n";
		$port=(strcmp($port=getenv("SERVER_PORT"),"") ? intval($port) : 80);
		$site="http://".(strcmp($site=getenv("SERVER_NAME"),"") ? $site : "localhost").($port==80 ? "" : ":".$port).GetEnv("REQUEST_URI");
		echo "<H2>Access this page using a URL like: $site?email=<A HREF=\"$site?email=hide@address.com\"><TT>hide@address.com</TT></A></H2>\n";
Return current item: E-mail address validation class