Validate/EmailAddress.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.
- 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
Package: Zend_Validate- 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')
As of RFC5753 (JAN 2010), the following blocks are no logner reserved:
- 128.0.0.0/16
- 191.255.0.0/16
- 223.255.255.0/24
Default valuearray('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")
Default valuearray(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
Methods
__construct(array | \Zend_Config $options = array()) : void
Instantiates hostname validator for local use
The following option keys are supported:
'hostname' => A hostname validator, see Zend_Validate_Hostname
'allow' => Options for the hostname validator, see Zend_Validate_Hostname::ALLOW_*
'mx' => If MX check should be enabled, boolean
'deep' => If a deep MX check should be done, boolean
Parameters_isReserved(string $host) : boolean
Returns if the given host is reserved
ParametersName | Type | Description |
---|
$host | string | |
---|
Returns _toIp(string $binary) : mixed
Converts a binary string to an IP address
ParametersName | Type | Description |
---|
$binary | string | |
---|
Returns isValid(string $value) : boolean
Defined by Zend_Validate_Interface
Returns true if and only if $value is a valid email address
according to RFC2822
ParametersName | Type | Description |
---|
$value | string | |
---|
ReturnsDetails- Link
- RFC2822
- Link
- US-ASCII characters
setDeepMxCheck(boolean $deep) : \Zend_Validate_EmailAddress
Set whether we check MX record should be a deep validation
ParametersName | Type | Description |
---|
$deep | boolean | Set deep to true to perform a deep validation process for MX records |
---|
Returns setDomainCheck(boolean $domain = true) : \Zend_Validate_EmailAddress
Sets if the domain should also be checked
or only the local part of the email address
ParametersName | Type | Description |
---|
$domain | boolean | |
---|
Returns 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
ParametersName | Type | Description |
---|
$messageString | string | |
---|
$messageKey | string | OPTIONAL |
---|
ReturnsThrows setOptions(array $options = array()) : \Zend_Validate_EmailAddress
Set options for the email validator
ParametersName | Type | Description |
---|
$options | array | |
---|
Returns setValidateMx(boolean $mx) : \Zend_Validate_EmailAddress
Set whether we check for a valid MX record via DNS
This only applies when DNS hostnames are validated
ParametersName | Type | Description |
---|
$mx | boolean | Set allowed to true to validate for MX records, and false to not validate them |
---|
ReturnsvalidateMxSupported() : boolean
Whether MX checking via getmxrr is supported or not
This currently only works on UNIX systems
Returns