PHPMailer\PHPMailer

PHPMailer::addrFormatpublicWP 1.0

Format an address for use in a message header.

Method of the class: PHPMailer{}

No Hooks.

Returns

String.

Usage

$PHPMailer = new PHPMailer();
$PHPMailer->addrFormat( $addr );
$addr(array) (required)
A 2-element indexed array, element 0 containing an address, element 1 containing a name like ['[email protected]', 'Joe User'].

PHPMailer::addrFormat() code WP 6.9

public function addrFormat($addr)
{
    if (!isset($addr[1]) || ($addr[1] === '')) { //No name provided
        return $this->secureHeader($addr[0]);
    }

    return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') .
        ' <' . $this->secureHeader($addr[0]) . '>';
}