}
}
Function PutLine($connection,$line)
{
if($this->debug)
$this->OutputDebug("C $line");
return(fputs($connection,"$line\r\n"));
}
Function ValidateEmailAddress($email)
{
if(IsSet($this->preg))
{
if(strlen($this->preg))
return(preg_match($this->preg,$email));
}
else
{
$this->preg=(function_exists("preg_match") ? "/".str_replace("/", "\\/", $this-
>email_regular_expression)."/" : "");
return($this->ValidateEmailAddress($email));
}
return(eregi($this->email_regular_expression,$email)!=0);
}
Function ValidateEmailHost($email,&$hosts)
{
if(!$this->ValidateEmailAddress($email))
return(0);
$user=$this->Tokenize($email,"@");
$domain=$this->Tokenize("");
$hosts=$weights=array();
$getmxrr=$this->getmxrr;
if(function_exists($getmxrr)
&& $getmxrr($domain,$hosts,$weights))
{
$mxhosts=array();
for($host=0;$host<count($hosts);$host++)
$mxhosts[$weights[$host]]=$hosts[$host];
KSort($mxhosts);
for(Reset($mxhosts),$host=0;$host<count($mxhosts);Next($mxhosts),$host++)
$hosts[$host]=$mxhosts[Key($mxhosts)];
}