API Documentation

Zend/Validate/EmailAddress.php

Show: inherited
Table of Contents

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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Validate  
Version
$Id: EmailAddress.php 24661 2012-02-26 07:32:09Z adamlundrigan $  

\Zend_Validate_EmailAddress

Package: Zend\Validate

Parent(s)
\Zend_Validate_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

Constant  INVALID = 'emailAddressInvalid'
Constant  INVALID_FORMAT = 'emailAddressInvalidFormat'
Constant  INVALID_HOSTNAME = 'emailAddressInvalidHostname'
Constant  INVALID_MX_RECORD = 'emailAddressInvalidMxRecord'
Constant  INVALID_SEGMENT = 'emailAddressInvalidSegment'
Constant  DOT_ATOM = 'emailAddressDotAtom'
Constant  QUOTED_STRING = 'emailAddressQuotedString'
Constant  INVALID_LOCAL_PART = 'emailAddressInvalidLocalPart'
Constant  LENGTH_EXCEEDED = 'emailAddressLengthExceeded'

Properties

Propertyprotectedstring  $_hostname= ''

Details
Type
string
Propertyprotectedarray  $_invalidIp= 'array( '0' => '0.0.0.0/8''

Default valuearray( '0' => '0.0.0.0/8'Details
Type
array
See
\http://en.wikipedia.org/wiki/IPv4  
Propertyprotectedstring  $_localPart= ''

Details
Type
string
Propertyprotectedarray  $_messageTemplates= 'array( self::INVALID => "Invalid type given. String expected"'

Default valuearray( self::INVALID => "Invalid type given. String expected"Details
Type
array
Propertyprotectedarray  $_messageVariables= 'array( 'hostname' => '_hostname''

Default valuearray( 'hostname' => '_hostname'Details
Type
array
Propertyprotected  $_options= 'array( 'mx' => false'

Internal options array

Default valuearray( 'mx' => falseDetails
Type

Methods

methodpublic__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
Name Type Description
$options array|\Zend_Config

OPTIONAL

methodprivate_isReserved( string $host ) : boolean

Returns if the given host is reserved

Parameters
Name Type Description
$host string
Returns
Type Description
boolean
methodprivate_toIp( string $binary ) : mixed

Converts a binary string to an IP address

Parameters
Name Type Description
$binary string
Returns
Type Description
mixed
methodprivate_validateHostnamePart( ) : boolean

Internal method to validate the hostname part of the email address

Returns
Type Description
boolean
methodprivate_validateLocalPart( ) : boolean

Internal method to validate the local part of the email address

Returns
Type Description
boolean
methodprivate_validateMXRecords( ) : boolean

Internal method to validate the servers MX records

Returns
Type Description
boolean
methodpublicgetDeepMxCheck( ) : boolean

Returns the set deepMxCheck option

Returns
Type Description
boolean
methodpublicgetDomainCheck( ) : \unknown

Returns the set domainCheck option

Returns
Type Description
\unknown
methodpublicgetHostnameValidator( ) : \Zend_Validate_Hostname

Returns the set hostname validator

Returns
Type Description
\Zend_Validate_Hostname
methodpublicgetOptions( ) : array

Returns all set Options

Returns
Type Description
array
methodpublicgetValidateMx( ) : boolean

Returns the set validateMx option

Returns
Type Description
boolean
methodpublicisValid( string $value ) : boolean

Defined by Zend_Validate_Interface

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

Parameters
Name Type Description
$value string
Returns
Type Description
boolean
Details
Link
RFC2822  
Link
US-ASCII characters  
methodpublicsetDeepMxCheck( boolean $deep ) : \Zend_Validate_EmailAddress

Set whether we check MX record should be a deep validation

Parameters
Name Type Description
$deep boolean

Set deep to true to perform a deep validation process for MX records

Returns
Type Description
\Zend_Validate_EmailAddress Fluid Interface
methodpublicsetDomainCheck( boolean $domain = true ) : \Zend_Validate_EmailAddress

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

Parameters
Name Type Description
$domain boolean
Returns
Type Description
\Zend_Validate_EmailAddress Fluid Interface
methodpublicsetHostnameValidator( \Zend_Validate_Hostname $hostnameValidator = null, int $allow = Zend_Validate_Hostname::ALLOW_DNS ) : void

Parameters
Name Type Description
$hostnameValidator \Zend_Validate_Hostname

OPTIONAL

$allow int

OPTIONAL

methodpublicsetMessage( 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

Parameters
Name Type Description
$messageString string
$messageKey string

OPTIONAL

Returns
Type Description
\Zend_Validate_Abstract Provides a fluent interface
Throws
Exception Description
\Zend_Validate_Exception
methodpublicsetOptions( array $options = array() ) : \Zend_Validate_EmailAddress

Set options for the email validator

Parameters
Name Type Description
$options array
Returns
Type Description
\Zend_Validate_EmailAddress fluid interface
methodpublicsetValidateMx( boolean $mx ) : \Zend_Validate_EmailAddress

Set whether we check for a valid MX record via DNS

This only applies when DNS hostnames are validated

Parameters
Name Type Description
$mx boolean

Set allowed to true to validate for MX records, and false to not validate them

Returns
Type Description
\Zend_Validate_EmailAddress Fluid Interface
methodpublicvalidateMxSupported( ) : boolean

Whether MX checking via getmxrr is supported or not

This currently only works on UNIX systems

Returns
Type Description
boolean
Documentation was generated by DocBlox 0.15.1.