Validate/EmailAddress.php
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Validate
- Version
- $Id$
\Zend_Validate_EmailAddress
- Parent(s)
- \Zend_Validate_Abstract
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
Properties
array $_invalidIp = array('0' => '0.0.0.0/8', '10' => '10.0.0.0/8', '100' => '100.64.0.0/10', '127' => '127.0.0.0/8', '169' => '169.254.0.0/16', '172' => '172.16.0.0/12', '192' => array('192.0.0.0/24', '192.0.2.0/24', '192.88.99.0/24', '192.168.0.0/16'), '198' => '198.18.0.0/15', '224' => '224.0.0.0/4', '240' => '240.0.0.0/4')
array('0' => '0.0.0.0/8', '10' => '10.0.0.0/8', '100' => '100.64.0.0/10', '127' => '127.0.0.0/8', '169' => '169.254.0.0/16', '172' => '172.16.0.0/12', '192' => array('192.0.0.0/24', '192.0.2.0/24', '192.88.99.0/24', '192.168.0.0/16'), '198' => '198.18.0.0/15', '224' => '224.0.0.0/4', '240' => '240.0.0.0/4')
Details- Type
- array
- See
- As of RFC6598 (APR 2012), the following blocks are now reserved: - 100.64.0.0/10
- See
- See
array $_messageTemplates = array(self::INVALID => "Invalid type given. String expected", self::INVALID_FORMAT => "'%value%' is not a valid email address in the basic format local-part@hostname", self::INVALID_HOSTNAME => "'%hostname%' is not a valid hostname for email address '%value%'", self::INVALID_MX_RECORD => "'%hostname%' does not appear to have a valid MX record for the email address '%value%'", self::INVALID_SEGMENT => "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network", self::DOT_ATOM => "'%localPart%' can not be matched against dot-atom format", self::QUOTED_STRING => "'%localPart%' can not be matched against quoted-string format", self::INVALID_LOCAL_PART => "'%localPart%' is not a valid local part for email address '%value%'", self::LENGTH_EXCEEDED => "'%value%' exceeds the allowed length")
array(self::INVALID => "Invalid type given. String expected", self::INVALID_FORMAT => "'%value%' is not a valid email address in the basic format local-part@hostname", self::INVALID_HOSTNAME => "'%hostname%' is not a valid hostname for email address '%value%'", self::INVALID_MX_RECORD => "'%hostname%' does not appear to have a valid MX record for the email address '%value%'", self::INVALID_SEGMENT => "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network", self::DOT_ATOM => "'%localPart%' can not be matched against dot-atom format", self::QUOTED_STRING => "'%localPart%' can not be matched against quoted-string format", self::INVALID_LOCAL_PART => "'%localPart%' is not a valid local part for email address '%value%'", self::LENGTH_EXCEEDED => "'%value%' exceeds the allowed length")
Details- Type
- array
array $_messageVariables = array('hostname' => '_hostname', 'localPart' => '_localPart')
array('hostname' => '_hostname', 'localPart' => '_localPart')
Details- Type
- array
$_options = array('mx' => false, 'deep' => false, 'domain' => true, 'allow' => \Zend_Validate_Hostname::ALLOW_DNS, 'hostname' => null)
array('mx' => false, 'deep' => false, 'domain' => true, 'allow' => \Zend_Validate_Hostname::ALLOW_DNS, 'hostname' => null)
Details- Type
- n/a
Methods
__construct(array | \Zend_Config $options = array()) : void
Instantiates hostname validator for local use
Name | Type | Description |
---|---|---|
$options | array | \Zend_Config | OPTIONAL |
_isReserved(string $host) : boolean
Returns if the given host is reserved
Name | Type | Description |
---|---|---|
$host | string |
Type | Description |
---|---|
boolean |
_toIp(string $binary) : mixed
Converts a binary string to an IP address
Name | Type | Description |
---|---|---|
$binary | string |
Type | Description |
---|---|
mixed |
_validateHostnamePart() : boolean
Internal method to validate the hostname part of the email address
Type | Description |
---|---|
boolean |
_validateLocalPart() : boolean
Internal method to validate the local part of the email address
Type | Description |
---|---|
boolean |
_validateMXRecords() : boolean
Internal method to validate the servers MX records
Type | Description |
---|---|
boolean |
getHostnameValidator() : \Zend_Validate_Hostname
Returns the set hostname validator
Type | Description |
---|---|
\Zend_Validate_Hostname |
isValid(string $value) : boolean
Defined by Zend_Validate_Interface
Name | Type | Description |
---|---|---|
$value | string |
Type | Description |
---|---|
boolean |
- Link
- RFC2822
- Link
- US-ASCII characters
setDeepMxCheck(boolean $deep) : \Zend_Validate_EmailAddress
Set whether we check MX record should be a deep validation
Name | Type | Description |
---|---|---|
$deep | boolean | Set deep to true to perform a deep validation process for MX records |
Type | Description |
---|---|
\Zend_Validate_EmailAddress | Fluid Interface |
setDomainCheck(boolean $domain = true) : \Zend_Validate_EmailAddress
Sets if the domain should also be checked or only the local part of the email address
Name | Type | Description |
---|---|---|
$domain | boolean |
Type | Description |
---|---|
\Zend_Validate_EmailAddress | Fluid Interface |
setHostnameValidator(\Zend_Validate_Hostname $hostnameValidator = null, int $allow = \Zend_Validate_Hostname::ALLOW_DNS) : void
Name | Type | Description |
---|---|---|
$hostnameValidator | \Zend_Validate_Hostname | OPTIONAL |
$allow | int | OPTIONAL |
setMessage(string $messageString, string $messageKey = null) : \Zend_Validate_Abstract
Sets the validation failure message template for a particular key Adds the ability to set messages to the attached hostname validator
Name | Type | Description |
---|---|---|
$messageString | string | |
$messageKey | string | OPTIONAL |
Type | Description |
---|---|
\Zend_Validate_Abstract | Provides a fluent interface |
Exception | Description |
---|---|
\Zend_Validate_Exception |
setOptions(array $options = array()) : \Zend_Validate_EmailAddress
Set options for the email validator
Name | Type | Description |
---|---|---|
$options | array |
Type | Description |
---|---|
\Zend_Validate_EmailAddress | fluid interface |
setValidateMx(boolean $mx) : \Zend_Validate_EmailAddress
Set whether we check for a valid MX record via DNS
Name | Type | Description |
---|---|---|
$mx | boolean | Set allowed to true to validate for MX records, and false to not validate them |
Type | Description |
---|---|
\Zend_Validate_EmailAddress | Fluid Interface |