<?php
header( 'Content-Type:application/json;charset=utf-8' );
include_once( 'JsonReturn.class.php' );
$result = JsonReturn::onVoid();
if( !isset($_GET["email"]) ) {
$p_emailAddress = "void";
} else {
$p_emailAddress = urldecode( filter_input( INPUT_GET, "email", FILTER_SANITIZE_EMAIL ) );
}
if( filter_var( $p_emailAddress, FILTER_VALIDATE_EMAIL ) ) {
require_once( 'emailValidation.class.php' );
$validator = new email_validation_class;
$validator->timeout = 10;
$validator->data_timeout = 0;
$validator->localuser = "system.admin";
$validator->localhost = "victoriahome.ch";
$validator->debug = 0;
$validator->html_debug = 0;
$validator->exclude_address = "";
$validator->invalid_email_domains_file = 'resources/invalidemaildomains.csv';
$validator->invalid_email_servers_file = 'resources/invalidemailservers.csv';
$validator->email_domains_white_list_file = 'resources/emaildomainswhitelist.csv';
if( strlen( $errorCode = $validator->ValidateAddress( $p_emailAddress, $errorReturn ) ) ) {
$result = JsonReturn::onError( "Error: " . HtmlSpecialChars( $errorReturn ) );
} else {
if( !$errorReturn ) {
if( count( $validator->suggestions ) ) {
$suggestion = $validator->suggestions[0];
$result = JsonReturn::onError( "Possible typo: did you mean " . HtmlSpecialChars( $suggestion ) . "?" );
} else {
$result = JsonReturn::onError( HtmlSpecialChars( $p_emailAddress ) . " is not a valid deliverable e-mail address." );
}
} else {
if( ( $deliverable = $validator->ValidateEmailBox( $p_emailAddress ) ) < 0 ) {
$result = JsonReturn::onError( "Warning: is was not possible to determine if " . HtmlSpecialChars( $p_emailAddress ) . " is a valid deliverable e-mail address." );
} else {
if( !$deliverable ) {
$result = JsonReturn::onError( "Error: " . HtmlSpecialChars( $p_emailAddress ) . " is not a deliverable e-mail address." );
} else {
$result = JsonReturn::onValue( $validator );
}
}
}
}
} else {
$result = JsonReturn::onError( "Syntax error found in email address." );
}
echo $result->toString();
?>
|