WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
функция не описана

PHPMailer\PHPMailer

PHPMailer::parseAddresses() public WP 1.0

Parse and validate a string containing one or more RFC822-style comma-separated email addresses of the form "display name <address>" into an array of name/address pairs. Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available. Note that quotes in the name part are removed.

{} Это метод класса: PHPMailer{}

Хуков нет.

Возвращает

Массив.

Использование

$result = PHPMailer::parseAddresses( $addrstr, $useimap );
$addrstr(строка) (обязательный)
The address list string
$useimap(true/false)
Whether to use the IMAP extension to parse the list
По умолчанию: true

Заметки

Код PHPMailer::parseAddresses() WP 5.5.1

<?php
public static function parseAddresses($addrstr, $useimap = true)
{
    $addresses = [];
    if ($useimap && function_exists('imap_rfc822_parse_adrlist')) {
        //Use this built-in parser if it's available
        $list = imap_rfc822_parse_adrlist($addrstr, '');
        foreach ($list as $address) {
            if (('.SYNTAX-ERROR.' !== $address->host) && static::validateAddress(
                $address->mailbox . '@' . $address->host
            )) {
                $addresses[] = [
                    'name' => (property_exists($address, 'personal') ? $address->personal : ''),
                    'address' => $address->mailbox . '@' . $address->host,
                ];
            }
        }
    } else {
        //Use this simpler parser
        $list = explode(',', $addrstr);
        foreach ($list as $address) {
            $address = trim($address);
            //Is there a separate name part?
            if (strpos($address, '<') === false) {
                //No separate name, just use the whole thing
                if (static::validateAddress($address)) {
                    $addresses[] = [
                        'name' => '',
                        'address' => $address,
                    ];
                }
            } else {
                list($name, $email) = explode('<', $address);
                $email = trim(str_replace('>', '', $email));
                if (static::validateAddress($email)) {
                    $addresses[] = [
                        'name' => trim(str_replace(['"', "'"], '', $name)),
                        'address' => $email,
                    ];
                }
            }
        }
    }

    return $addresses;
}