diff --git a/core/lib/Drupal/Core/Mail/Plugin/Mail/TestHtmlMailCollector.php b/core/lib/Drupal/Core/Mail/Plugin/Mail/TestHtmlMailCollector.php
new file mode 100644
index 0000000..b83c24d
--- /dev/null
+++ b/core/lib/Drupal/Core/Mail/Plugin/Mail/TestHtmlMailCollector.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace Drupal\Core\Mail\Plugin\Mail;
+
+use Drupal\Core\Mail\MailFormatHelper;
+use Drupal\Core\Mail\Plugin\Mail\TestMailCollector;
+
+
+/**
+ * A mail sending implementation that captures sent messages to a variable.
+ *
+ * This class is for running tests or for development and does not convert HTML
+ * to plaintext.
+ *
+ * @Mail(
+ *   id = "test_html_mail_collector",
+ *   label = @Translation("HTML test mailer"),
+ *   description = @Translation("Saves the message as HTML to a variable.")
+ * )
+ */
+class TestHtmlMailCollector extends TestMailCollector {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function format(array $message) {
+    // Join the body array into one string.
+    $message['body'] = implode(PHP_EOL, $message['body']);
+    // Wrap the mail body for sending.
+    $message['body'] = MailFormatHelper::wrapMail($message['body']);
+    return $message;
+  }
+}

