You are here

public static function HTMLMailMime::encodeEmail in HTML Mail 8

Same name and namespace in other branches
  1. 8.3 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 657
Provides the MailMIME class for creating MIME-formatted email messages.

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;
}