File: validateQuotedString.php

package info (click to toggle)
php-mail 1.2.0-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 228 kB
  • sloc: php: 1,110; xml: 164; sh: 9; makefile: 9
file content (17 lines) | stat: -rwxr-xr-x 640 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
require_once '../Mail/RFC822.php';
$address_string = '"Joe Doe \(from Somewhere\)" <doe@example.com>, postmaster@example.com, root';
// $address_string = "Joe Doe from Somewhere <doe@example.com>, postmaster@example.com, root";
echo $address_string . "\n";

$address_array = Mail_RFC822::parseAddressList($address_string, "example.com");
if (!is_array($address_array) || count($address_array) < 1) {
    die("something is wrong\n");
}

foreach ($address_array as $val) {
    echo "mailbox : " . $val->mailbox . "\n";
    echo "host    : " . $val->host . "\n";
    echo "personal: " . $val->personal . "\n";
}
print_r($address_array);