<% '========================================= const hexVeErrSuccess = 0 const hexVeErrLicenseFileNotFound = 2 const hexVeErrCouldNotOpenLicenseFile = 3 const hexVeErrCorruptLicenseFile = 4 const hexVeErrWrongProductLicense = 5 const hexVeErrWrongVersionLicense = 6 const hexVeErrUnlicensedProcessors = 7 const hexVeErrAddressNotAvailable = 10049 const hexVeErrNetworkDown = 10050 const hexVeErrNetworkUnreachable = 10051 const hexVeErrConnectionAborted = 10053 const hexVeErrConnectionReset = 10054 const hexVeErrTimedOut = 10060 const hexVeErrConnectionRefused = 10061 const hexVeErrHostUnreachable = 10065 const hexVeErrHostNotFound = 11001 const hexVeErrTryAgain = 11002 const hexVeErrNoRecovery = 11003 const hexVeErrNoData = 11004 const hexVeErrUnexpected = &h20000000 const hexVeErrAddrTooLong = &h20000001 const hexVeErrExtraTextPresent = &h20000002 const hexVeErrIllegalChar = &h20000003 const hexVeErrUnbalancedParenthesis = &h20000004 const hexVeErrUnbalancedSquareBracket = &h20000005 const hexVeErrUnbalancedAngleBracket = &h20000006 const hexVeErrQuotationMarksNotClosed = &h20000007 const hexVeErrDomainLiteralPresent = &h20000008 const hexVeErrMisplacedDomainLiteral = &h20000009 const hexVeErrMisplacedQuotedString = &h2000000a const hexVeErrNoLocalPart = &h2000000b const hexVeErrNoDomain = &h2000000c const hexVeErrInvalidDomain = &h2000000d const hexVeErrInvalidDomainLiteral = &h2000000e const hexVeErrNoDnsServerConfigured = &h2000000f const hexVeErrDomainDoesNotExist = &h20000010 const hexVeErrNoMxForDomain = &h20000011 const hexVeErrCouldNotVerifyRecipient = &h20000012 const hexVeErrRecipientRejected = &h20000013 const hexVeErrNoAddrSpecified = &h20000014 const hexVeLevelBad = 0 const hexVeLevelSyntax = 1 const hexVeLevelDns = 2 const hexVeLevelSmtp = 3 const hexVeOptionAllowExtraText = &h00000001 const hexVeOptionAllow8bitExtraText = &h00000002 const hexVeOptionDontRequireDomainDot = &h00000004 const hexVeOptionDecodeMimeEncodedWords = &h00000008 const hexVeOptionDisallowDomainLiterals = &h00000010 const hexVeOptionRequireMx = &h00000020 const hexVeOptionTryVrfyAndExpn = &h00000040 const hexVeTimeoutDnsTotal = 1 const hexVeTimeoutSmtpTotal = 2 '========================================= public function GetVeErrorString(Err) select case Err case hexVeErrTimedOut GetVeErrorString = "Timed out" case hexVeErrConnectionRefused GetVeErrorString = "Connection refused" case hexVeErrConnectionReset GetVeErrorString = "Connection reset" case hexVeErrHostUnreachable GetVeErrorString = "Host unreachable" case hexVeErrAddressNotAvailable GetVeErrorString = "Address not available" case hexVeErrNetworkDown GetVeErrorString = "Network down" case hexVeErrNetworkUnreachable GetVeErrorString = "Network unreachable" case hexVeErrConnectionAborted GetVeErrorString = "Connection aborted" case hexVeErrHostNotFound GetVeErrorString = "Host not found" case hexVeErrTryAgain GetVeErrorString = "Try again" case hexVeErrNoRecovery GetVeErrorString = "No recovery" case hexVeErrNoData GetVeErrorString = "No data" case hexVeErrUnexpected GetVeErrorString = "Unexpected error" case hexVeErrAddrTooLong GetVeErrorString = "Address too long" case hexVeErrExtraTextPresent GetVeErrorString = "Extra text is present" case hexVeErrIllegalChar GetVeErrorString = "Illegal character" case hexVeErrUnbalancedParenthesis GetVeErrorString = "Unbalanced parenthesis" case hexVeErrUnbalancedSquareBracket GetVeErrorString = "Unbalanced square bracket" case hexVeErrUnbalancedAngleBracket GetVeErrorString = "Unbalanced angle bracket" case hexVeErrQuotationMarksNotClosed GetVeErrorString = "Quotation marks not closed" case hexVeErrDomainLiteralPresent GetVeErrorString = "A domain literal is present" case hexVeErrMisplacedDomainLiteral GetVeErrorString = "Misplaced domain literal" case hexVeErrMisplacedQuotedString GetVeErrorString = "Misplaced quoted string" case hexVeErrNoLocalPart GetVeErrorString = "No local part specified" case hexVeErrNoDomain GetVeErrorString = "No domain specified" case hexVeErrInvalidDomain GetVeErrorString = "Invalid domain" case hexVeErrInvalidDomainLiteral GetVeErrorString = "Invalid domain literal" case hexVeErrNoDnsServerConfigured GetVeErrorString = "No DNS servers configured" case hexVeErrDomainDoesNotExist GetVeErrorString = "Domain does not exist" case hexVeErrNoMxForDomain GetVeErrorString = "No mail exchange for domain" case hexVeErrCouldNotVerifyRecipient GetVeErrorString = "Could not verify recipient" case hexVeErrRecipientRejected GetVeErrorString = "Recipient rejected" case else GetVeErrorString = GetLicenseErrorString( Err ) end select end function '========================================= function GetVeLevelString( Level ) select case Level case hexVeLevelBad GetVeLevelString = "Bad address" case hexVeLevelSyntax GetVeLevelString = "Syntax" case hexVeLevelDns GetVeLevelString = "DNS" case hexVeLevelSmtp GetVeLevelString = "SMTP" case else GetVeLevelString = "[unknown level]" end select end function '========================================= function GetLicenseErrorString(lErr) select case lErr case 0 GetLicenseErrorString = "None" case 2 GetLicenseErrorString = "License file not found" case 3 GetLicenseErrorString = "Could not open license file" case 4 GetLicenseErrorString = "License file is corrupt" case 5 GetLicenseErrorString = "License is for wrong product" case 6 GetLicenseErrorString = "License is for wrong version" case 7 GetLicenseErrorString = "Running on machine with unlicensed processors" case else GetLicenseErrorString = "Unknown error: " & lErr end select end function '========================================= function hexVerifyEmail(emailAddress, hexResponse, hexResponseCode, hexResponseText, hexTimeout, hexLevel, hexMx, hexExtraText, hexDomainDot, hexDomainLiterals, hexVrfy, hexMXRecords, emailTest) set emailTest = Server.CreateObject("HexValidEmail.Connection") emailTest.Timeouts(1).Value = hexTimeout emailTest.Timeouts(2).Value = hexTimeout emailTest.Options = emailTest.Options or iif(hexExtraText, hexVeOptionAllowExtraText, 0) _ or iif(hexDomainDot, hexVeOptionDontRequireDomainDot, 0) _ or iif(hexDomainLiterals, hexVeOptionDisallowDomainLiterals, 0) _ or iif(hexMx, hexVeOptionRequireMx, 0) _ or iif(hexVrfy, hexVeOptionTryVrfyAndExpn, 0) isValid = emailTest.Validate(emailAddress, hexLevel) if isValid = hexLevel then hexVerifyEmail = true else hexVerifyEmail = false hexResponse = isValid hexResponseCode = emailTest.Error hexResponseText = GetVeErrorString(emailTest.Error) set hexMXRecords = emailTest.MxRecs end function '========================================= function iif( b, v1, v2 ) if (b) then iif = v1 else iif = v2 end function '========================================= %>