Class Horde_Mail_Rfc822
RFC 822/2822/3490/5322 Email parser/validator.
Methods summary
public
array
|
#
parseAddressList( mixed $address, array $params = array() )
Starts the whole process.
Starts the whole process.
Parameters
- $address
- <p>The address(es) to validate. Either a string
(since 1.0.0), a Horde_Mail_Rfc822_Object (since
1.2.0), or an array of strings and/or
Horde_Mail_Rfc822_Objects (since 1.2.0).</p>
- $params
- <p>Optional parameters:
- default_domain: (string) Default domain/host etc.
DEFAULT: localhost
- limit: (integer) Stop processing after this many addresses.
DEFAULT: No limit (0)
- nest_groups: (boolean) Whether to return the structure with groups
nested for easier viewing.
DEFAULT: true
- validate: (boolean) Strict validation of personal part data? If
false, attempts to allow non-ASCII characters and
non-quoted strings in the personal data, and will
silently abort if an unparseable address is found.
DEFAULT: true</p>
Returns
array A structured array of addresses. Each value is a
Horde_Mail_Rfc822_Address object (or, if 'nest_groups'
is true, the value can also be a Horde_Mail_Rfc822_Group
object).
Throws
|
public
string
|
#
encode( string $str, string $type = 'address' )
Quotes and escapes the given string if necessary using rules contained
in RFC 2822 [3.2.5].
Quotes and escapes the given string if necessary using rules contained
in RFC 2822 [3.2.5].
Parameters
- $str
- The string to be quoted and escaped.
- $type
- Either 'address', or 'personal'.
Returns
string The correctly quoted and escaped string.
Since
1.2.0
|
public
string
|
#
trimAddress( string $address )
If an email address has no personal information, get rid of any angle
brackets (<>) around it.
If an email address has no personal information, get rid of any angle
brackets (<>) around it.
Parameters
- $address
- The address to trim.
Returns
string The trimmed address.
Since
1.2.0
|
public
integer
|
#
approximateCount( string $data )
Returns an approximate count of how many addresses are in the string.
This is APPROXIMATE as it only splits based on a comma which has no
preceding backslash.
Returns an approximate count of how many addresses are in the string.
This is APPROXIMATE as it only splits based on a comma which has no
preceding backslash.
Parameters
- $data
- Addresses to count.
Returns
integer Approximate count.
|
public
mixed
|
#
isValidInetAddress( string $data, boolean $strict = false )
Validates whether an email is of the common internet form:
@. This can be sufficient for most people.
Validates whether an email is of the common internet form:
@. This can be sufficient for most people.
Optional stricter mode can be utilized which restricts mailbox
characters allowed to: alphanumeric, full stop, hyphen, and underscore.
Parameters
- $data
- Address to check.
- $strict
- Strict check?
Returns
mixed False if it fails, an indexed array username/domain if
it matches.
|