Migrate Mime Mail integration
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).
Comments
Comment #1
Sharique CreditAttribution: Sharique as a volunteer commentedComment #2
Anonymous (not verified) CreditAttribution: Anonymous at Netuxo Ltd (RIP) commentedI 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).