DNSCheckValidation
in package
implements
EmailValidation
Interfaces, Classes, Traits and Enums
Table of Contents
- DNS_RECORD_TYPES_TO_CHECK = DNS_MX + DNS_A + DNS_AAAA
- $error : InvalidEmail|null
- $mxRecords : array<string|int, mixed>
- $warnings : array<string|int, mixed>
- __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
DNS_RECORD_TYPES_TO_CHECK
protected
int
DNS_RECORD_TYPES_TO_CHECK
= DNS_MX + DNS_A + DNS_AAAA
Properties
$error
private
InvalidEmail|null
$error
$mxRecords
private
array<string|int, mixed>
$mxRecords
= []
$warnings
private
array<string|int, mixed>
$warnings
= []
Methods
__construct()
public
__construct() : mixed
Return values
mixed —getError()
Returns the validation error.
public
getError() : InvalidEmail|null
Return values
InvalidEmail|null —getWarnings()
Returns the validation warnings.
public
getWarnings() : array<string|int, Warning>
Return values
array<string|int, Warning> —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.