Migrate Mime Mail integration

Comments

Sharique’s picture

Project: » Previewable email templates
Version: » 8.x-1.x-dev
Assigned: mandarmbhagwat78 » Unassigned
Anonymous’s picture

I am able to send html mail using Swiftmailer, but in my hook_mail_alter function I had to add this for mails to work:

$message['headers']['Content-Type'] = "text/html";
// See https://www.drupal.org/node/2677530
$message['format'] = 'text/html';
// Allow the body to rendered.
foreach ( $message['body'] as $mkey => $mbody ) {
$message['body'][$mkey] = Markup::create($message['body'][$mkey]);
}

I guess this could better go into pet.module, into the function pet_send_one_mail where the body is created.

In addition, I adapted function pet_has_mimemail() to return true when either mimemail or swiftmailer is installed (as we do not use mimemail).