Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

103 lines (84 sloc) 2.637 kB
--TEST--
Mail_RFC822: Address Parsing
--FILE--
<?php
require_once 'Mail/RFC822.php';
$parser = &new Mail_RFC822();
/* A simple, bare address. */
$address = 'user@example.com';
print_r($parser->parseAddressList($address, null, true, true));
/* Address groups. */
$address = 'My Group: "Richard" <richard@localhost> (A comment), ted@example.com (Ted Bloggs), Barney;';
print_r($parser->parseAddressList($address, null, true, true));
/* A valid address with spaces in the local part. */
$address = '<"Jon Parise"@php.net>';
print_r($parser->parseAddressList($address, null, true, true));
/* An invalid address with spaces in the local part. */
$address = '<Jon Parise@php.net>';
$result = $parser->parseAddressList($address, null, true, true);
if (PEAR::isError($result)) echo $result->getMessage() . "\n";
--EXPECT--
Array
(
[0] => stdClass Object
(
[personal] =>
[comment] => Array
(
)
[mailbox] => user
[host] => example.com
)
)
Array
(
[0] => stdClass Object
(
[groupname] => My Group
[addresses] => Array
(
[0] => stdClass Object
(
[personal] => "Richard"
[comment] => Array
(
[0] => A comment
)
[mailbox] => richard
[host] => localhost
)
[1] => stdClass Object
(
[personal] =>
[comment] => Array
(
[0] => Ted Bloggs
)
[mailbox] => ted
[host] => example.com
)
[2] => stdClass Object
(
[personal] =>
[comment] => Array
(
)
[mailbox] => Barney
[host] => localhost
)
)
)
)
Array
(
[0] => stdClass Object
(
[personal] =>
[comment] => Array
(
)
[mailbox] => "Jon Parise"
[host] => php.net
)
)
Validation failed for: <Jon Parise@php.net>
Jump to Line
Something went wrong with that request. Please try again.