PHP Manual
Prev |  | Next

# imap_rfc822_parse_adrlist

(PHP 3>= 3.0.2, PHP 4 )

imap_rfc822_parse_adrlist -- Parses an address string

## Description

array imap_rfc822_parse_adrlist ( string address, string default_host)

This function parses the address string as defined in RFC2822 and for each address, returns an array of objects. The objects properties are:

- mailbox - the mailbox name (username)

- host - the host name

- personal - the personal name

- adl - at domain source route

Example 1. imap_rfc822_parse_adrlist() example

    $address_string = "Hartmut Holzgraefe <hartmut@cvs.php.net>, postmaster@somedomain.net, root";
    $address_array  = imap_rfc822_parse_adrlist($address_string,"somedomain.net");
    if(! is_array($address_array)) die("somethings wrong\n");

    reset($address_array);
    while(list($key,$val)=each($address_array)){
      print "mailbox : ".$val->mailbox."<br>\n";
      print "host    : ".$val->host."<br>\n";
      print "personal: ".$val->personal."<br>\n";
      print "adl     : ".$val->adl."<p>\n";
    }

Prev | Home | Next
imap_reopen | Up | imap_rfc822_parse_headers