HumHub Documentation (unofficial)

DNSCheckValidation
in package
implements EmailValidation

Table of Contents

Interfaces

EmailValidation

Constants

RESERVED_DNS_TOP_LEVEL_NAMES  = [ // Reserved Top Level DNS Names 'test', 'example', 'invalid', 'localhost', // mDNS 'local', // Private DNS Namespaces 'intranet', 'internal', 'private', 'corp', 'home', 'lan', ]
Reserved Top Level DNS Names (https://tools.ietf.org/html/rfc2606#section-2), mDNS and private DNS Namespaces (https://tools.ietf.org/html/rfc6762#appendix-G)
DNS_RECORD_TYPES_TO_CHECK  = DNS_MX + DNS_A + DNS_AAAA

Properties

$dnsGetRecord  : DNSGetRecordWrapper
$error  : InvalidEmail|null
$mxRecords  : array<string|int, mixed>
$warnings  : array<string|int, mixed>

Methods

__construct()  : mixed
getError()  : InvalidEmail|null
Returns the validation error.
getWarnings()  : array<string|int, Warning>
Returns the validation warnings.
isValid()  : bool
Returns true if the given email is valid.
checkDns()  : bool
validateDnsRecords()  : bool
Validate the DNS records for given host.
validateMxRecord()  : bool
Validate an MX record

Constants

RESERVED_DNS_TOP_LEVEL_NAMES

Reserved Top Level DNS Names (https://tools.ietf.org/html/rfc2606#section-2), mDNS and private DNS Namespaces (https://tools.ietf.org/html/rfc6762#appendix-G)

public mixed RESERVED_DNS_TOP_LEVEL_NAMES = [ // Reserved Top Level DNS Names 'test', 'example', 'invalid', 'localhost', // mDNS 'local', // Private DNS Namespaces 'intranet', 'internal', 'private', 'corp', 'home', 'lan', ]

DNS_RECORD_TYPES_TO_CHECK

protected int DNS_RECORD_TYPES_TO_CHECK = DNS_MX + DNS_A + DNS_AAAA

Properties

Methods

isValid()

Returns true if the given email is valid.

public isValid(string $email, EmailLexer $emailLexer) : bool
Parameters
$email : string

The email you want to validate.

$emailLexer : EmailLexer

The email lexer.

Return values
bool

checkDns()

protected checkDns(string $host) : bool
Parameters
$host : string
Return values
bool

validateDnsRecords()

Validate the DNS records for given host.

private validateDnsRecords(string $host) : bool
Parameters
$host : string

A set of DNS records in the format returned by dns_get_record.

Return values
bool

True on success.

validateMxRecord()

Validate an MX record

private validateMxRecord(array<string|int, mixed> $dnsRecord) : bool
Parameters
$dnsRecord : array<string|int, mixed>

Given DNS record.

Return values
bool

True if valid.


        
On this page

Search results