public function PHPMailer::addrFormat

5.x PHPMailer.php public PHPMailer::addrFormat($addr)

Format an address for use in a message header.

Parameters

array $addr A 2-element indexed array, element 0 containing an address, element 1 containing a name like: ['joe@example.com', 'Joe User']

Return value

string

3 calls to PHPMailer::addrFormat()
PHPMailer::addrAppend in inc/PHPMailer/src/PHPMailer.php
Create recipient headers.
PHPMailer::createHeader in inc/PHPMailer/src/PHPMailer.php
Assemble message headers.
PHPMailer::mailSend in inc/PHPMailer/src/PHPMailer.php
Send mail using the PHP mail() function.

File

inc/PHPMailer/src/PHPMailer.php, line 2133

Class

PHPMailer
PHPMailer - PHP email creation and transport class.

Namespace

PHPMailer\PHPMailer

Code

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

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