IMP_Compose::recipientList PHP Method

recipientList() public method

Cleans up and returns the recipient list. Method designed to parse user entered data; does not encode/validate addresses.
public recipientList ( array $hdr ) : array
$hdr array An array of MIME headers and/or address list objects. Recipients will be extracted from the 'to', 'cc', and 'bcc' entries.
return array An array with the following entries: - has_input: (boolean) True if at least one of the headers contains user input. - header: (array) Contains the cleaned up 'to', 'cc', and 'bcc' address list (Horde_Mail_Rfc822_List objects). - list: (Horde_Mail_Rfc822_List) Recipient addresses.
    public function recipientList($hdr)
    {
        $addrlist = new Horde_Mail_Rfc822_List();
        $has_input = false;
        $header = array();
        foreach (array('to', 'cc', 'bcc') as $key) {
            if (isset($hdr[$key])) {
                $ob = IMP::parseAddressList($hdr[$key]);
                if (count($ob)) {
                    $addrlist->add($ob);
                    $header[$key] = $ob;
                    $has_input = true;
                } else {
                    $header[$key] = null;
                }
            }
        }
        return array('has_input' => $has_input, 'header' => $header, 'list' => $addrlist);
    }