diff -u b/src/Plugin/Mail/SwiftMailer.php b/src/Plugin/Mail/SwiftMailer.php
--- b/src/Plugin/Mail/SwiftMailer.php
+++ b/src/Plugin/Mail/SwiftMailer.php
@@ -588,10 +588,11 @@
// separated by the mail line endings. Keep Markup objects and escape others
// and then treat the result as safe markup.
$line_endings = Settings::get('mail_line_endings', PHP_EOL);
- $message['body'] = Markup::create(implode($line_endings, array_map(function ($body) {
- // If the body contains no html tags we can assume newlines will need be
- // converted to
.
- if (strlen(strip_tags($body)) === strlen($body)) {
+ $applicable_format = $this->getApplicableFormat($message);
+ $message['body'] = Markup::create(implode($line_endings, array_map(function ($body) use ($applicable_format) {
+ // If the body contains no html tags but the applicable format is HTML,
+ // we can assume newlines will need be converted to
.
+ if ($applicable_format == SWIFTMAILER_FORMAT_HTML && strlen(strip_tags($body)) === strlen($body)) {
// The default fallback format is 'plain_text', which escapes markup,
// converts new lines to
and converts URLs to links.
$build = [