1995. Class

1995.1. Zend\Validator\EmailAddress

1995.1.1. Methods

1995.1.1.1. __construct

__construct()

Instantiates hostname validator for local use

The following additional option keys are supported: ‘hostnameValidator’ => A hostname validator, see ZendValidatorHostname ‘allow’ => Options for the hostname validator, see ZendValidatorHostname::ALLOW_* ‘useMxCheck’ => If MX check should be enabled, boolean ‘useDeepMxCheck’ => If a deep MX check should be done, boolean

Parameters:array|Traversable – OPTIONAL

1995.1.1.2. setMessage

setMessage()

Sets the validation failure message template for a particular key Adds the ability to set messages to the attached hostname validator

Parameters:
  • string
  • string – OPTIONAL
Return type:

AbstractValidator Provides a fluent interface

1995.1.1.3. getHostnameValidator

getHostnameValidator()

Returns the set hostname validator

If was not previously set then lazy load a new one

Return type:Hostname

1995.1.1.4. setHostnameValidator

setHostnameValidator()

@param Hostname $hostnameValidator OPTIONAL

Return type:EmailAddress Provides a fluent interface

1995.1.1.5. getAllow

getAllow()

Returns the allow option of the attached hostname validator

Return type:integer

1995.1.1.6. setAllow

setAllow()

Sets the allow option of the hostname validator to use

Parameters:integer
Return type:EmailAddress Provides a fluent interface

1995.1.1.7. isMxSupported

isMxSupported()

Whether MX checking via getmxrr is supported or not

Return type:bool

1995.1.1.8. getMxCheck

getMxCheck()

Returns the set validateMx option

Return type:bool

1995.1.1.9. useMxCheck

useMxCheck()

Set whether we check for a valid MX record via DNS

This only applies when DNS hostnames are validated

Parameters:bool – Set allowed to true to validate for MX records, and false to not validate them
Return type:EmailAddress Fluid Interface

1995.1.1.10. getDeepMxCheck

getDeepMxCheck()

Returns the set deepMxCheck option

Return type:bool

1995.1.1.11. useDeepMxCheck

useDeepMxCheck()

Use deep validation for MX records

Parameters:bool – Set deep to true to perform a deep validation process for MX records
Return type:EmailAddress Fluid Interface

1995.1.1.12. getDomainCheck

getDomainCheck()

Returns the set domainCheck option

Return type:bool

1995.1.1.13. useDomainCheck

useDomainCheck()

Sets if the domain should also be checked or only the local part of the email address

Parameters:bool
Return type:EmailAddress Fluid Interface

1995.1.1.14. isReserved

isReserved()

Returns if the given host is reserved

The following addresses are seen as reserved ‘0.0.0.0/8’, ‘10.0.0.0/8’, ‘127.0.0.0/8’ ‘100.64.0.0/10’ ‘172.16.0.0/12’ ‘198.18.0.0/15’ ‘169.254.0.0/16’, ‘192.168.0.0/16’ ‘192.0.2.0/24’, ‘192.88.99.0/24’, ‘198.51.100.0/24’, ‘203.0.113.0/24’ ‘224.0.0.0/4’, ‘240.0.0.0/4’

Parameters:string
Return type:bool Returns false when minimal one of the given addresses is not reserved

1995.1.1.15. validateLocalPart

validateLocalPart()

Internal method to validate the local part of the email address

Return type:bool

1995.1.1.16. getMXRecord

getMXRecord()

Returns the found MX Record information after validation including weight for further processing

Return type:array

1995.1.1.17. validateMXRecords

validateMXRecords()

Internal method to validate the servers MX records

Return type:bool

1995.1.1.18. validateHostnamePart

validateHostnamePart()

Internal method to validate the hostname part of the email address

Return type:bool

1995.1.1.19. splitEmailParts

splitEmailParts()

Splits the given value in hostname and local part of the email address

Parameters:string – Email address to be split
Return type:bool Returns false when the email can not be split

1995.1.1.20. isValid

isValid()

Defined by ZendValidatorValidatorInterface

Returns true if and only if $value is a valid email address according to RFC2822

Parameters:string
Return type:bool

1995.1.2. Constants

1995.1.2.1. INVALID

1995.1.2.2. INVALID_FORMAT

1995.1.2.3. INVALID_HOSTNAME

1995.1.2.4. INVALID_MX_RECORD

1995.1.2.5. INVALID_SEGMENT

1995.1.2.6. DOT_ATOM

1995.1.2.7. QUOTED_STRING

1995.1.2.8. INVALID_LOCAL_PART

1995.1.2.9. LENGTH_EXCEEDED