public function PHPMailer::secureHeader

5.x PHPMailer.php public PHPMailer::secureHeader($str)

Strip newlines to prevent header injection.

Parameters

string $str:

Return value

string

5 calls to PHPMailer::secureHeader()
PHPMailer::addrFormat in inc/PHPMailer/src/PHPMailer.php
Format an address for use in a message header.
PHPMailer::attachAll in inc/PHPMailer/src/PHPMailer.php
Attach all file, string, and binary attachments to the message. Returns an empty string on failure.
PHPMailer::createHeader in inc/PHPMailer/src/PHPMailer.php
Assemble message headers.
PHPMailer::mailPassthru in inc/PHPMailer/src/PHPMailer.php
Call mail() in a safe_mode-aware fashion. Also, unless sendmail_path points to sendmail (or something that claims to be sendmail), don't pass params (not a perfect fix, but it will do).
PHPMailer::preSend in inc/PHPMailer/src/PHPMailer.php
Prepare a message for sending.

File

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

Class

PHPMailer
PHPMailer - PHP email creation and transport class.

Namespace

PHPMailer\PHPMailer

Code

public function secureHeader($str) 
 {
  return trim(str_replace(["\r", "\n"], '', $str));
}