You are here

public function HtmlMailMime::toEmail in HTML Mail 8.3

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

Return a (headers, body) pair for sending.

Merge the $headers parameter with the MIME headers and return it with the fully-encoded message body.

Parameters

array $headers: The original message headers array.

Return value

array An array containing two elements, the merged headers and the fully- encoded message body, both ready to send.

File

src/Utility/HtmlMailMime.php, line 513

Class

HtmlMailMime
Class HtmlMailMime.

Namespace

Drupal\htmlmail\Utility

Code

public function toEmail(array $headers) {
  $headers = self::toHeaders($headers);
  $mime_headers = $this
    ->headers();
  return [
    array_diff_key($headers, $mime_headers) + $mime_headers,
    $this
      ->get([], NULL, TRUE),
  ];
}