You are here

public static function HtmlMailMime::encodeEmail in HTML Mail 8.3

Same name and namespace in other branches
  1. 8 src/Utility/HTMLMailMime.php \Drupal\htmlmail\Utility\HTMLMailMime::encodeEmail()

Convert message headers and body into an encoded string.

Parameters

array $headers: The message headers as a string or an array.

string|array $body: The message body as a string or an array.

string $eol: The end of line characters.

Return value

string The fully-encoded email message as a string.

1 call to HtmlMailMime::encodeEmail()
HtmlMailSystem::formatMailMime in src/Plugin/Mail/HtmlMailSystem.php
Use the MailMime class to format the message body.

File

src/Utility/HtmlMailMime.php, line 667

Class

HtmlMailMime
Class HtmlMailMime.

Namespace

Drupal\htmlmail\Utility

Code

public static function encodeEmail(array $headers, $body, $eol) {

  // Standardize capitalization of header names.
  $headers = self::toHeaders($headers);
  $output = '';
  foreach ($headers as $name => $value) {
    $output .= $name . ': ' . \Mail_mimePart::encodeHeader($name, $value, 'UTF-8', 'quoted-printable', $eol) . $eol;
  }
  $output .= $eol . self::concat($body, $eol);
  return $output;
}