You are here

public function HTMLMailMime::toEmail in HTML Mail 8

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

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),
  ];
}