wppaste
WordPress

PHPMailer::createBody(): string

Source
wp-includes/PHPMailer/PHPMailer.php:2860
Assemble the message body.

Description

Returns an empty string on failure.

Compatibility

WordPress
core
PHP
7.4–8.6-dev
  • 6.7.10
  • 6.8.11
  • 6.9.10
  • 7.0.7
  • 7.1.3

Present in every tracked release (6.7.10 to 7.1.3), and compiles on PHP 7.4 through 8.6-dev.

Return value

string
The assembled message body

Performance profile

How much work a call to PHPMailer::createBody() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.

Cost class
Heavy

Reads or writes the filesystem via file_put_contents().

Scaling
Scales with input

The body loops, so the work grows with how much data it finds.

Instructions
49–258

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 792.

Plugin surface
None

Nothing here hands control to plugin code.

Called by
0

Nothing in core calls this; the cost is only what you spend yourself.

What it touches

  • filesystemfilesystem accessfile_put_contents()called directly

What one call costs · 88 distinct outcomes

One number would be a lie: the work depends on which branch runs. These are every distinct cost PHPMailer::createBody() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
$bodyEncoding !== false49–65->setBoundaries(), ->setWordWrap(), ->encodeString(), ->isError()
$bodyEncoding !== false && $altBodyEncoding !== false55–71->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->encodeString(), ->isError()
$bodyEncoding !== false && ->isError()58–73->setBoundaries(), ->setWordWrap(), ->encodeString(), ->isError(), ->lang()
$bodyEncoding !== false && $altBodyEncoding !== false && ->isError()64–79->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->encodeString(), ->isError(), ->lang()
$bodyEncoding !== false67–72->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->attachAll(), ->isError()
$bodyEncoding !== false && $altBodyEncoding !== false73–79->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->attachAll(), ->isError()
$bodyEncoding !== false && ->isError()76–80->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->attachAll(), ->isError(), ->lang()
$bodyEncoding !== false && $altBodyEncoding !== false && ->isError()82–86->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->attachAll(), ->isError(), ->lang()
$bodyEncoding !== false && empty($value)89–98->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError()
$bodyEncoding !== false && $altBodyEncoding !== false && empty($value)95–104->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError()
$bodyEncoding !== false && empty($value) && ->isError()98–106->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError(), ->lang()
$bodyEncoding !== false && $altBodyEncoding !== false && empty($value) && ->isError()104–112->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError(), ->lang()
76 further outcomes, up to 258 instructions
$bodyEncoding !== false108–115->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->attachAll(), ->isError()
$bodyEncoding !== false && !->isError()113–130->setBoundaries(), ->setWordWrap(), ->encodeString(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && $altBodyEncoding !== false114–121->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->attachAll(), ->isError()
$bodyEncoding !== false && ->isError()117–123->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->attachAll(), ->isError(), ->lang()
$bodyEncoding !== false && !empty($value)118–128->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError()
$bodyEncoding !== false && $altBodyEncoding !== false && !->isError()119–136->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->encodeString(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && empty($value)123–136->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError()
$bodyEncoding !== false && $altBodyEncoding !== false && ->isError()123–129->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->attachAll(), ->isError(), ->lang()
$bodyEncoding !== false && !->isError()123–140->setBoundaries(), ->setWordWrap(), ->encodeString(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && $altBodyEncoding !== false && !empty($value)124–134->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError()
$bodyEncoding !== false && !empty($value) && ->isError()127–136->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError(), ->lang()
$bodyEncoding !== false && !empty($value)128–137->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), stripos(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError()
$bodyEncoding !== false128–139->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->endBoundary(), ->isError()
$bodyEncoding !== false && $altBodyEncoding !== false && empty($value)129–142->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError()
$bodyEncoding !== false && $altBodyEncoding !== false && !->isError()129–146->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->encodeString(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && !->isError()131–137->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && empty($value) && ->isError()132–144->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError(), ->lang()
$bodyEncoding !== false && $altBodyEncoding !== false && !empty($value) && ->isError()133–142->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError(), ->lang()
$bodyEncoding !== false && $altBodyEncoding !== false && !empty($value)134–143->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), stripos(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError()
$bodyEncoding !== false && $altBodyEncoding !== false134–145->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->endBoundary(), ->isError()
$bodyEncoding !== false && !empty($value) && ->isError()137–145->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), stripos(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError(), ->lang()
$bodyEncoding !== false && ->isError()137–147->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->endBoundary(), ->isError(), ->lang()
$bodyEncoding !== false && $altBodyEncoding !== false && !->isError()137–145->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && $altBodyEncoding !== false && empty($value) && ->isError()138–150->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError(), ->lang()
$bodyEncoding !== false && !->isError()141–147->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && $altBodyEncoding !== false && !empty($value) && ->isError()143–151->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), stripos(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError(), ->lang()
$bodyEncoding !== false && $altBodyEncoding !== false && ->isError()143–153->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->endBoundary(), ->isError(), ->lang()
$bodyEncoding !== false && $altBodyEncoding !== false && !->isError()147–155->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && !empty($value)150–164->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError()
$bodyEncoding !== false && empty($value) && !->isError()153–163->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && $altBodyEncoding !== false && !empty($value)156–170->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError()
$bodyEncoding !== false && !empty($value) && ->isError()159–172->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError(), ->lang()
$bodyEncoding !== false && $altBodyEncoding !== false && empty($value) && !->isError()159–169->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && !empty($value)160–173->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), stripos(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError()
$bodyEncoding !== false162–177->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->endBoundary(), ->attachAll(), ->isError()
$bodyEncoding !== false && empty($value) && !->isError()163–173->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && $altBodyEncoding !== false && !empty($value) && ->isError()165–178->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError(), ->lang()
$bodyEncoding !== false && $altBodyEncoding !== false && !empty($value)166–179->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), stripos(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError()
$bodyEncoding !== false && $altBodyEncoding !== false168–183->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->endBoundary(), ->attachAll(), ->isError()
$bodyEncoding !== false && !empty($value) && ->isError()169–181->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), stripos(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError(), ->lang()
$bodyEncoding !== false && $altBodyEncoding !== false && empty($value) && !->isError()169–179->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && ->isError()171–185->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->endBoundary(), ->attachAll(), ->isError(), ->lang()
$bodyEncoding !== false && !->isError()172–180->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && $altBodyEncoding !== false && !empty($value) && ->isError()175–187->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), stripos(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError(), ->lang()
$bodyEncoding !== false && $altBodyEncoding !== false && ->isError()177–191->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->endBoundary(), ->attachAll(), ->isError(), ->lang()
$bodyEncoding !== false && $altBodyEncoding !== false && !->isError()178–186->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && !->isError()182–190->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && !empty($value) && !->isError()182–193->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && empty($value) && !->isError()187–201->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && $altBodyEncoding !== false && !->isError()188–196->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && $altBodyEncoding !== false && !empty($value) && !->isError()188–199->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && !empty($value) && !->isError()192–203->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && !empty($value) && !->isError()192–202->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), stripos(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && !->isError()192–204->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->endBoundary(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && $altBodyEncoding !== false && empty($value) && !->isError()193–207->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && empty($value) && !->isError()197–211->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && $altBodyEncoding !== false && !empty($value) && !->isError()198–209->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && $altBodyEncoding !== false && !empty($value) && !->isError()198–208->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), stripos(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && $altBodyEncoding !== false && !->isError()198–210->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->endBoundary(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && !empty($value) && !->isError()202–212->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), stripos(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && !->isError()202–214->setBoundaries(), ->setWordWrap(), ->getBoundary(), ->encodeString(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->endBoundary(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && $altBodyEncoding !== false && empty($value) && !->isError()203–217->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && $altBodyEncoding !== false && !empty($value) && !->isError()208–218->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), stripos(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && $altBodyEncoding !== false && !->isError()208–220->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->getBoundary(), ->encodeString(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->endBoundary(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && !empty($value) && !->isError()214–229->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && $altBodyEncoding !== false && !empty($value) && !->isError()220–235->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && !empty($value) && !->isError()224–239->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && !empty($value) && !->isError()224–238->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), stripos(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && !->isError()226–242->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->endBoundary(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && $altBodyEncoding !== false && !empty($value) && !->isError()230–245->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && $altBodyEncoding !== false && !empty($value) && !->isError()230–244->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), stripos(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && $altBodyEncoding !== false && !->isError()232–248->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->endBoundary(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), unlink(), ->lang(), openssl_error_string(), openssl_pkcs7_sign()
$bodyEncoding !== false && !empty($value) && !->isError()234–248->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), stripos(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && !->isError()236–252->setBoundaries(), ->setWordWrap(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->endBoundary(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && $altBodyEncoding !== false && !empty($value) && !->isError()240–254->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->getBoundary(), ->encodeString(), stripos(), ->getBoundary(), ->encodeString(), ->endBoundary(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()
$bodyEncoding !== false && $altBodyEncoding !== false && !->isError()242–258->setBoundaries(), ->setWordWrap(), ::hasLineLongerThanMax(), ->textLine(), ->headerLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->textLine(), ->headerLine(), ->textLine(), ->textLine(), ->getBoundary(), ->encodeString(), ->attachAll(), ->endBoundary(), ->attachAll(), ->isError(), sys_get_temp_dir(), tempnam(), sys_get_temp_dir(), tempnam(), file_put_contents(), realpath(), realpath(), unlink(), file_get_contents(), unlink(), explode()

This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev79249–25831
8.579249–25831
8.479249–25831
8.379249–25831
8.279249–258311 more instruction than PHP 8.1
8.179149–25831
7.479149–25831

An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.

Uses · 15

  • stripos()
  • \PHPMailer\PHPMailer\PHPMailer::setBoundaries()
  • \PHPMailer\PHPMailer\PHPMailer::getMailMIME()
  • \PHPMailer\PHPMailer\PHPMailer::setWordWrap()
  • \PHPMailer\PHPMailer\PHPMailer::has8bitChars()
  • static::hasLineLongerThanMax()
  • \PHPMailer\PHPMailer\PHPMailer::getBoundary()
  • \PHPMailer\PHPMailer\PHPMailer::encodeString()
  • \PHPMailer\PHPMailer\PHPMailer::attachAll()
  • \PHPMailer\PHPMailer\PHPMailer::textLine()
  • \PHPMailer\PHPMailer\PHPMailer::headerLine()
  • \PHPMailer\PHPMailer\PHPMailer::endBoundary()
Show all 15
  • \PHPMailer\PHPMailer\PHPMailer::isError()
  • \PHPMailer\PHPMailer\Exception::__construct()
  • \PHPMailer\PHPMailer\PHPMailer::lang()

Source code

    public function createBody()    {        $body = '';        //Create unique IDs and preset boundaries        $this->setBoundaries();         if ($this->sign_key_file) {            $body .= $this->getMailMIME() . static::$LE;        }         $this->setWordWrap();         $bodyEncoding = $this->Encoding;        $bodyCharSet = $this->CharSet;        //Can we do a 7-bit downgrade?        if (static::ENCODING_8BIT === $bodyEncoding && !$this->has8bitChars($this->Body)) {            $bodyEncoding = static::ENCODING_7BIT;            //All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit            $bodyCharSet = static::CHARSET_ASCII;        }        //If lines are too long, and we're not already using an encoding that will shorten them,        //change to quoted-printable transfer encoding for the body part only        if (static::ENCODING_BASE64 !== $this->Encoding && static::hasLineLongerThanMax($this->Body)) {            $bodyEncoding = static::ENCODING_QUOTED_PRINTABLE;        }         $altBodyEncoding = $this->Encoding;        $altBodyCharSet = $this->CharSet;        //Can we do a 7-bit downgrade?        if (static::ENCODING_8BIT === $altBodyEncoding && !$this->has8bitChars($this->AltBody)) {            $altBodyEncoding = static::ENCODING_7BIT;            //All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit            $altBodyCharSet = static::CHARSET_ASCII;        }        //If lines are too long, and we're not already using an encoding that will shorten them,        //change to quoted-printable transfer encoding for the alt body part only        if (static::ENCODING_BASE64 !== $altBodyEncoding && static::hasLineLongerThanMax($this->AltBody)) {            $altBodyEncoding = static::ENCODING_QUOTED_PRINTABLE;        }        //Use this as a preamble in all multipart message types        $mimepre = '';        switch ($this->message_type) {            case 'inline':                $body .= $mimepre;                $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);                $body .= $this->encodeString($this->Body, $bodyEncoding);                $body .= static::$LE;                $body .= $this->attachAll('inline', $this->boundary[1]);                break;            case 'attach':                $body .= $mimepre;                $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);                $body .= $this->encodeString($this->Body, $bodyEncoding);                $body .= static::$LE;                $body .= $this->attachAll('attachment', $this->boundary[1]);                break;            case 'inline_attach':                $body .= $mimepre;                $body .= $this->textLine('--' . $this->boundary[1]);                $body .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED . ';');                $body .= $this->textLine(' boundary="' . $this->boundary[2] . '";');                $body .= $this->textLine(' type="' . static::CONTENT_TYPE_TEXT_HTML . '"');                $body .= static::$LE;                $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding);                $body .= $this->encodeString($this->Body, $bodyEncoding);                $body .= static::$LE;                $body .= $this->attachAll('inline', $this->boundary[2]);                $body .= static::$LE;                $body .= $this->attachAll('attachment', $this->boundary[1]);                break;            case 'alt':                $body .= $mimepre;                $body .= $this->getBoundary(                    $this->boundary[1],                    $altBodyCharSet,                    static::CONTENT_TYPE_PLAINTEXT,                    $altBodyEncoding                );                $body .= $this->encodeString($this->AltBody, $altBodyEncoding);                $body .= static::$LE;

Changelog

Unchanged from 6.7.10 through 7.1.3.

  1. 6.7.10
  2. 6.8.11
  3. 6.9.10
  4. 7.0.7
  5. 7.1.3

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.8.11 tag, from src/wp-includes/PHPMailer/PHPMailer.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.