diff --git a/core/core.services.yml b/core/core.services.yml
index b1fbd4f..5c06d01 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -584,9 +584,9 @@ services:
   flood:
     class: Drupal\Core\Flood\DatabaseBackend
     arguments: ['@database', '@request']
-  mail.factory:
-    class: Drupal\Core\Mail\MailFactory
-    arguments: ['@config.factory']
+  plugin.manager.mail:
+    class: Drupal\Core\Mail\MailManager
+    arguments: ['@container.namespaces', '@cache.cache', '@language_manager', '@module_handler', '@config.factory']
   plugin.manager.condition:
     class: Drupal\Core\Condition\ConditionManager
     parent: default_plugin_manager
diff --git a/core/includes/mail.inc b/core/includes/mail.inc
index 61dfb7e..fa10168 100644
--- a/core/includes/mail.inc
+++ b/core/includes/mail.inc
@@ -81,7 +81,7 @@
  *   called to complete the $message structure which will already contain common
  *   defaults.
  * @param string $key
- *   A key to identify the e-mail sent. The final e-mail id for e-mail altering
+ *   A key to identify the e-mail sent. The final message ID for e-mail altering
  *   will be {$module}_{$key}.
  * @param string $to
  *   The e-mail address or addresses where the message will be sent to. The
@@ -189,23 +189,23 @@ function drupal_mail($module, $key, $to, $langcode, $params = array(), $reply =
 }
 
 /**
- * Returns an object that implements Drupal\Core\Mail\MailInterface.
+ * Returns an instance of the mail plugin to use for a given message ID.
  *
  * @param string $module
  *   The module name which was used by drupal_mail() to invoke hook_mail().
  * @param string $key
- *   A key to identify the e-mail sent. The final e-mail ID for the e-mail
+ *   A key to identify the e-mail sent. The final message ID for the e-mail
  *   alter hook in drupal_mail() would have been {$module}_{$key}.
  *
  * @return \Drupal\Core\Mail\MailInterface
- *   An object that implements Drupal\Core\Mail\MailInterface.
+ *   A mail plugin instance.
  *
- * @throws \Exception
+ * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
  *
- * @see \Drupal\Core\Mail\MailFactory::get()
+ * @see \Drupal\Core\Mail\MailManager::getInstance()
  */
 function drupal_mail_system($module, $key) {
-  return \Drupal::service('mail.factory')->get($module, $key);
+  return \Drupal::service('plugin.manager.mail')->getInstance(array('module' => $module, 'key' => $key));
 }
 
 /**
diff --git a/core/lib/Drupal/Core/Annotation/Mail.php b/core/lib/Drupal/Core/Annotation/Mail.php
new file mode 100644
index 0000000..abfddd3
--- /dev/null
+++ b/core/lib/Drupal/Core/Annotation/Mail.php
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Annotation\Mail.
+ */
+
+namespace Drupal\Core\Annotation;
+
+use Drupal\Component\Annotation\Plugin;
+
+/**
+ * Defines a Mail annotation object.
+ *
+ * @Annotation
+ */
+class Mail extends Plugin {
+
+  /**
+   * The plugin ID.
+   *
+   * @var string
+   */
+  public $id;
+
+  /**
+   * The human-readable name of the mail plugin.
+   *
+   * @var \Drupal\Core\Annotation\Translation
+   *
+   * @ingroup plugin_translatable
+   */
+  public $label;
+
+  /**
+   * A short description of the mail plugin.
+   *
+   * @var \Drupal\Core\Annotation\Translation
+   *
+   * @ingroup plugin_translatable
+   */
+  public $description;
+
+}
diff --git a/core/lib/Drupal/Core/Mail/MailInterface.php b/core/lib/Drupal/Core/Mail/MailInterface.php
index d3e3173..62a6319 100644
--- a/core/lib/Drupal/Core/Mail/MailInterface.php
+++ b/core/lib/Drupal/Core/Mail/MailInterface.php
@@ -17,10 +17,10 @@
    *
    * Allows to preprocess, format, and postprocess a mail message before it is
    * passed to the sending system. By default, all messages may contain HTML and
-   * are converted to plain-text by the Drupal\Core\Mail\PhpMail implementation.
-   * For example, an alternative implementation could override the default
-   * implementation and additionally sanitize the HTML for usage in a
-   * MIME-encoded e-mail, but still invoking the Drupal\Core\Mail\PhpMail
+   * are converted to plain-text by the Drupal\Core\Mail\Plugin\Mail\PhpMail
+   * implementation. For example, an alternative implementation could override
+   * the default implementation and also sanitize the HTML for usage in a MIME-
+   * encoded email, but still invoking the Drupal\Core\Mail\Plugin\Mail\PhpMail
    * implementation to generate an alternate plain-text version for sending.
    *
    * @param array $message
diff --git a/core/lib/Drupal/Core/Mail/MailFactory.php b/core/lib/Drupal/Core/Mail/MailManager.php
similarity index 26%
rename from core/lib/Drupal/Core/Mail/MailFactory.php
rename to core/lib/Drupal/Core/Mail/MailManager.php
index dc1b706..89703c8 100644
--- a/core/lib/Drupal/Core/Mail/MailFactory.php
+++ b/core/lib/Drupal/Core/Mail/MailManager.php
@@ -2,18 +2,23 @@
 
 /**
  * @file
- * Contains \Drupal\Core\Mail\MailFactory.
+ * Contains \Drupal\Core\Mail\MailManager.
  */
 
 namespace Drupal\Core\Mail;
 
-use Drupal\Core\Config\ConfigFactory;
+use Drupal\Core\Plugin\DefaultPluginManager;
+use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Language\LanguageManagerInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Component\Utility\String;
+use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException;
 
 /**
- * Factory for creating mail system objects.
+ * Mail plugin manager.
  */
-class MailFactory {
+class MailManager extends DefaultPluginManager {
 
   /**
    * Config object for mail system configurations.
@@ -23,104 +28,115 @@ class MailFactory {
   protected $mailConfig;
 
   /**
-   * List of already instantiated mail system objects.
+   * List of already instantiated mail plugins.
    *
    * @var array
    */
   protected $instances = array();
 
   /**
-   * Constructs a MailFActory object.
+   * Constructs the MailManager object.
    *
-   * @param \Drupal\Core\Config\ConfigFactory $configFactory
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations.
+   * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
+   *   Cache backend instance to use.
+   * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
+   *   The language manager.
+   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
+   *   The module handler to invoke the alter hook with.
+   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    *   The configuration factory.
    */
-  public function __construct(ConfigFactory $configFactory) {
-    $this->mailConfig = $configFactory->get('system.mail');
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, ModuleHandlerInterface $module_handler, ConfigFactoryInterface $config_factory) {
+    parent::__construct('Plugin/Mail', $namespaces);
+    $this->setCacheBackend($cache_backend, $language_manager, 'mail_backend_plugins');
+    $this->mailConfig = $config_factory->get('system.mail');
   }
 
-
   /**
-   * Returns an object that implements \Drupal\Core\Mail\MailInterface.
+   * Overrides PluginManagerBase::getInstance().
    *
-   * Allows for one or more custom mail backends to format and send mail messages
-   * composed using drupal_mail().
+   * Returns an instance of the mail plugin to use for a given message ID.
    *
    * The selection of a particular implementation is controlled via the config
    * 'system.mail.interface', which is a keyed array.  The default
-   * implementation is the class whose name is the value of 'default' key. A
+   * implementation is the mail plugin whose ID is the value of 'default' key. A
    * more specific match first to key and then to module will be used in
-   * preference to the default. To specify a different class for all mail sent
-   * by one module, set the class name as the value for the key corresponding to
-   * the module name. To specify a class for a particular message sent by one
-   * module, set the class name as the value for the array key that is the
-   * message id, which is "${module}_${key}".
+   * preference to the default. To specify a different plugin for all mail sent
+   * by one module, set the plugin ID as the value for the key corresponding to
+   * the module name. To specify a plugin for a particular message sent by one
+   * module, set the plugin ID as the value for the array key that is the
+   * message ID, which is "${module}_${key}".
    *
    * For example to debug all mail sent by the user module by logging it to a
    * file, you might set the variable as something like:
    *
    * @code
    * array(
-   *   'default' => 'Drupal\Core\Mail\PhpMail',
-   *   'user' => 'Drupal\devel\DevelMailLog',
+   *   'default' => 'php_mail',
+   *   'user' => 'devel_mail_log',
    * );
    * @endcode
    *
-   * Finally, a different system can be specified for a specific e-mail ID (see
+   * Finally, a different system can be specified for a specific message ID (see
    * the $key param), such as one of the keys used by the contact module:
    *
    * @code
    * array(
-   *   'default' => 'Drupal\Core\Mail\PhpMail',
-   *   'user' => 'Drupal\devel\DevelMailLog',
-   *   'contact_page_autoreply' => 'Drupal\example\NullMail',
+   *   'default' => 'php_mail',
+   *   'user' => 'devel_mail_log',
+   *   'contact_page_autoreply' => 'null_mail',
    * );
    * @endcode
    *
-   * Other possible uses for system include a mail-sending class that actually
+   * Other possible uses for system include a mail-sending plugin that actually
    * sends (or duplicates) each message to SMS, Twitter, instant message, etc,
-   * or a class that queues up a large number of messages for more efficient
+   * or a plugin that queues up a large number of messages for more efficient
    * bulk sending or for sending via a remote gateway so as to reduce the load
    * on the local server.
    *
-   * @param string $module
-   *   The module name which was used by drupal_mail() to invoke hook_mail().
-   * @param string $key
-   *   A key to identify the e-mail sent. The final e-mail ID for the e-mail
-   *   alter hook in drupal_mail() would have been {$module}_{$key}.
+   * @param array $options
+   *   An array with the following key/value pairs:
+   *   - module: (string) The module name which was used by drupal_mail() to
+   *     invoke hook_mail().
+   *   - key: (string) A key to identify the email sent. The final message ID
+   *     is a string represented as {$module}_{$key}.
    *
    * @return \Drupal\Core\Mail\MailInterface
-   *   An object that implements Drupal\Core\Mail\MailInterface.
+   *   A mail plugin instance.
    *
-   * @throws \Exception
+   * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
    */
-  public function get($module, $key) {
-    $id = $module . '_' . $key;
+  public function getInstance(array $options) {
+    $module = $options['module'];
+    $key = $options['key'];
+    $message_id = $module . '_' . $key;
 
     $configuration = $this->mailConfig->get('interface');
 
-    // Look for overrides for the default class, starting from the most specific
-    // id, and falling back to the module name.
-    if (isset($configuration[$id])) {
-      $class = $configuration[$id];
+    // Look for overrides for the default mail plugin, starting from the most
+    // specific message_id, and falling back to the module name.
+    if (isset($configuration[$message_id])) {
+      $plugin_id = $configuration[$message_id];
     }
     elseif (isset($configuration[$module])) {
-      $class = $configuration[$module];
+      $plugin_id = $configuration[$module];
     }
     else {
-      $class = $configuration['default'];
+      $plugin_id = $configuration['default'];
     }
 
-    if (empty($this->instances[$class])) {
-      $interfaces = class_implements($class);
-      if (isset($interfaces['Drupal\Core\Mail\MailInterface'])) {
-        $this->instances[$class] = new $class();
+    if (empty($this->instances[$plugin_id])) {
+      $plugin = $this->createInstance($plugin_id);
+      if (is_subclass_of($plugin, '\Drupal\Core\Mail\MailInterface')) {
+        $this->instances[$plugin_id] = $plugin;
       }
       else {
-        throw new \Exception(String::format('Class %class does not implement interface %interface', array('%class' => $class, '%interface' => 'Drupal\Core\Mail\MailInterface')));
+        throw new InvalidPluginDefinitionException($plugin_id, String::format('Class %class does not implement interface %interface', array('%class' => get_class($plugin), '%interface' => 'Drupal\Core\Mail\MailInterface')));
       }
     }
-    return $this->instances[$class];
+    return $this->instances[$plugin_id];
   }
-
 }
diff --git a/core/lib/Drupal/Core/Mail/PhpMail.php b/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php
similarity index 92%
rename from core/lib/Drupal/Core/Mail/PhpMail.php
rename to core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php
index 7bf290c..fba97bf 100644
--- a/core/lib/Drupal/Core/Mail/PhpMail.php
+++ b/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php
@@ -2,13 +2,21 @@
 
 /**
  * @file
- * Definition of Drupal\Core\Mail\PhpMail.
+ * Definition of Drupal\Core\Mail\Plugin\Mail\PhpMail.
  */
 
-namespace Drupal\Core\Mail;
+namespace Drupal\Core\Mail\Plugin\Mail;
+
+use Drupal\Core\Mail\MailInterface;
 
 /**
  * The default Drupal mail backend using PHP's mail function.
+ *
+ * @Mail(
+ *   id = "php_mail",
+ *   label = @Translation("PHP Mailer"),
+ *   description = @Translation("Sends the message as plain text, using PHP's native mail() function.")
+ * )
  */
 class PhpMail implements MailInterface {
 
diff --git a/core/lib/Drupal/Core/Mail/TestMailCollector.php b/core/lib/Drupal/Core/Mail/Plugin/Mail/TestMailCollector.php
similarity index 58%
rename from core/lib/Drupal/Core/Mail/TestMailCollector.php
rename to core/lib/Drupal/Core/Mail/Plugin/Mail/TestMailCollector.php
index 3b3e056..d4e2cc9 100644
--- a/core/lib/Drupal/Core/Mail/TestMailCollector.php
+++ b/core/lib/Drupal/Core/Mail/Plugin/Mail/TestMailCollector.php
@@ -2,21 +2,29 @@
 
 /**
  * @file
- * Contains \Drupal\Core\Mail\TestMailCollector.
+ * Contains \Drupal\Core\Mail\Plugin\Mail\TestMailCollector.
  */
 
-namespace Drupal\Core\Mail;
+namespace Drupal\Core\Mail\Plugin\Mail;
+
+use Drupal\Core\Mail\MailInterface;
 
 /**
  * Defines a mail sending implementation that captures sent messages to the
  * state system.
  *
  * This class is for running tests or for development.
+ *
+ * @Mail(
+ *   id = "test_mail_collector",
+ *   label = @Translation("Mail Collector"),
+ *   description = @Translation("Does not send the message, but stores it in Drupal within the state system. Used for testing.")
+ * )
  */
 class TestMailCollector extends PhpMail implements MailInterface {
 
   /**
-   * Overrides \Drupal\Core\Mail\PhpMail::mail().
+   * Overrides \Drupal\Core\Mail\Plugin\Mail\PhpMail::mail().
    *
    * Accepts an e-mail message and stores it with the state system.
    */
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index 3b9d264..a9e8291 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -832,7 +832,7 @@ protected function setUp() {
     // While this should be enforced via settings.php prior to installation,
     // some tests expect to be able to test mail system implementations.
     \Drupal::config('system.mail')
-      ->set('interface.default', 'Drupal\Core\Mail\TestMailCollector')
+      ->set('interface.default', 'test_mail_collector')
       ->save();
 
     // Restore the original Simpletest batch.
diff --git a/core/modules/system/config/system.mail.yml b/core/modules/system/config/system.mail.yml
index e3eb768..a7147a7 100644
--- a/core/modules/system/config/system.mail.yml
+++ b/core/modules/system/config/system.mail.yml
@@ -1,2 +1,2 @@
 interface:
- default: 'Drupal\Core\Mail\PhpMail'
+ default: 'php_mail'
diff --git a/core/modules/system/lib/Drupal/system/Tests/InstallerTest.php b/core/modules/system/lib/Drupal/system/Tests/InstallerTest.php
index 34a82ac..479624a 100644
--- a/core/modules/system/lib/Drupal/system/Tests/InstallerTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/InstallerTest.php
@@ -143,7 +143,7 @@ protected function setUp() {
     // Manually configure the test mail collector implementation to prevent
     // tests from sending out e-mails and collect them in state instead.
     \Drupal::config('system.mail')
-      ->set('interface.default', 'Drupal\Core\Mail\TestMailCollector')
+      ->set('interface.default', 'test_mail_collector')
       ->save();
 
     // When running from run-tests.sh we don't get an empty current path which
diff --git a/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php b/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php
index 927b7b1..3dfdb69 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php
@@ -8,20 +8,19 @@
 namespace Drupal\system\Tests\Mail;
 
 use Drupal\Core\Language\Language;
-use Drupal\Core\Mail\MailInterface;
 use Drupal\simpletest\WebTestBase;
 
 /**
- * Defines a mail class used for testing.
+ * Tests related to the mail system.
  */
-class MailTest extends WebTestBase implements MailInterface {
+class MailTest extends WebTestBase {
 
   /**
    * Modules to enable.
    *
    * @var array
    */
-  public static $modules = array('simpletest');
+  public static $modules = array('simpletest', 'system_mail_failure_test');
 
   /**
    * The most recent message that was sent through the test case.
@@ -39,24 +38,19 @@ public static function getInfo() {
     );
   }
 
-  function setUp() {
-    parent::setUp();
-
-    // Set MailTestCase (i.e. this class) as the SMTP library
-    \Drupal::config('system.mail')->set('interface.default', 'Drupal\system\Tests\Mail\MailTest')->save();
-  }
-
   /**
    * Assert that the pluggable mail system is functional.
    */
   public function testPluggableFramework() {
-    $language_interface = language(Language::TYPE_INTERFACE);
+    // Switch mail backends.
+    \Drupal::config('system.mail')->set('interface.default', 'test_php_mail_failure')->save();
 
-    // Use MailTestCase for sending a message.
-    drupal_mail('simpletest', 'mail_test', 'testing@example.com', $language_interface->id);
+    // Get the default MailInterface class instance.
+    $mail_backend = drupal_mail_system('default', 'default');
 
-    // Assert whether the message was sent through the send function.
-    $this->assertEqual(self::$sent_message['to'], 'testing@example.com', 'Pluggable mail system is extendable.');
+    // Assert whether the default mail backend is an instance of the expected
+    // class.
+    $this->assertTrue($mail_backend instanceof \Drupal\system_mail_failure_test\Plugin\Mail\TestPhpMailFailure, 'Pluggable mail system is extendable.');
   }
 
   /**
@@ -67,14 +61,19 @@ public function testPluggableFramework() {
   public function testCancelMessage() {
     $language_interface = language(Language::TYPE_INTERFACE);
 
-    // Reset the class variable holding a copy of the last sent message.
-    self::$sent_message = NULL;
+    // Use the state system collector mail backend.
+    \Drupal::config('system.mail')->set('interface.default', 'test_mail_collector')->save();
+    // Reset the state variable that holds sent messages.
+    \Drupal::state()->set('system.test_mail_collector', array());
 
     // Send a test message that simpletest_mail_alter should cancel.
     drupal_mail('simpletest', 'cancel_test', 'cancel@example.com', $language_interface->id);
+    // Retrieve sent message.
+    $captured_emails = \Drupal::state()->get('system.test_mail_collector');
+    $sent_message = end($captured_emails);
 
     // Assert that the message was not actually sent.
-    $this->assertNull(self::$sent_message, 'Message was canceled.');
+    $this->assertFalse($sent_message, 'Message was canceled.');
   }
 
   /**
@@ -83,45 +82,28 @@ public function testCancelMessage() {
   public function testFromAndReplyToHeader() {
     global $language;
 
-    // Reset the class variable holding a copy of the last sent message.
-    self::$sent_message = NULL;
+    // Use the state system collector mail backend.
+    \Drupal::config('system.mail')->set('interface.default', 'test_mail_collector')->save();
+    // Reset the state variable that holds sent messages.
+    \Drupal::state()->set('system.test_mail_collector', array());
     // Send an e-mail with a reply-to address specified.
     $from_email = 'Drupal <simpletest@example.com>';
     $reply_email = 'someone_else@example.com';
     drupal_mail('simpletest', 'from_test', 'from_test@example.com', $language, array(), $reply_email);
-    // Test that the reply-to e-mail is just the e-mail and not the site name and
-    // default sender e-mail.
-    $this->assertEqual($from_email, self::$sent_message['headers']['From'], 'Message is sent from the site email account.');
-    $this->assertEqual($reply_email, self::$sent_message['headers']['Reply-to'], 'Message reply-to headers are set.');
-    $this->assertFalse(isset(self::$sent_message['headers']['Errors-To']), 'Errors-to header must not be set, it is deprecated.');
+    // Test that the reply-to e-mail is just the e-mail and not the site name
+    // and default sender e-mail.
+    $captured_emails = \Drupal::state()->get('system.test_mail_collector');
+    $sent_message = end($captured_emails);
+    $this->assertEqual($from_email, $sent_message['headers']['From'], 'Message is sent from the site email account.');
+    $this->assertEqual($reply_email, $sent_message['headers']['Reply-to'], 'Message reply-to headers are set.');
+    $this->assertFalse(isset($sent_message['headers']['Errors-To']), 'Errors-to header must not be set, it is deprecated.');
 
-    self::$sent_message = NULL;
     // Send an e-mail and check that the From-header contains the site name.
     drupal_mail('simpletest', 'from_test', 'from_test@example.com', $language);
-    $this->assertEqual($from_email, self::$sent_message['headers']['From'], 'Message is sent from the site email account.');
-    $this->assertFalse(isset(self::$sent_message['headers']['Reply-to']), 'Message reply-to is not set if not specified.');
-    $this->assertFalse(isset(self::$sent_message['headers']['Errors-To']), 'Errors-to header must not be set, it is deprecated.');
-  }
-
-  /**
-   * Concatenate and wrap the e-mail body for plain-text mails.
-   *
-   * @see \Drupal\Core\Mail\PhpMail
-   */
-  public function format(array $message) {
-    // Join the body array into one string.
-    $message['body'] = implode("\n\n", $message['body']);
-    // Convert any HTML to plain-text.
-    $message['body'] = drupal_html_to_text($message['body']);
-    // Wrap the mail body for sending.
-    $message['body'] = drupal_wrap_mail($message['body']);
-    return $message;
-  }
-
-  /**
-   * Send function that is called through the mail system.
-   */
-  public function mail(array $message) {
-    self::$sent_message = $message;
+    $captured_emails = \Drupal::state()->get('system.test_mail_collector');
+    $sent_message = end($captured_emails);
+    $this->assertEqual($from_email, $sent_message['headers']['From'], 'Message is sent from the site email account.');
+    $this->assertFalse(isset($sent_message['headers']['Reply-to']), 'Message reply-to is not set if not specified.');
+    $this->assertFalse(isset($sent_message['headers']['Errors-To']), 'Errors-to header must not be set, it is deprecated.');
   }
 }
diff --git a/core/modules/system/tests/modules/system_mail_failure_test/lib/Drupal/system_mail_failure_test/TestPhpMailFailure.php b/core/modules/system/tests/modules/system_mail_failure_test/lib/Drupal/system_mail_failure_test/Plugin/Mail/TestPhpMailFailure.php
similarity index 40%
rename from core/modules/system/tests/modules/system_mail_failure_test/lib/Drupal/system_mail_failure_test/TestPhpMailFailure.php
rename to core/modules/system/tests/modules/system_mail_failure_test/lib/Drupal/system_mail_failure_test/Plugin/Mail/TestPhpMailFailure.php
index f20472a..2ada2e3 100644
--- a/core/modules/system/tests/modules/system_mail_failure_test/lib/Drupal/system_mail_failure_test/TestPhpMailFailure.php
+++ b/core/modules/system/tests/modules/system_mail_failure_test/lib/Drupal/system_mail_failure_test/Plugin/Mail/TestPhpMailFailure.php
@@ -2,12 +2,12 @@
 
 /**
  * @file
- * Contains \Drupal\system_mail_failure_test\TestPhpMailFailure.
+ * Contains \Drupal\system_mail_failure_test\Plugin\Mail\TestPhpMailFailure.
  */
 
-namespace Drupal\system_mail_failure_test;
+namespace Drupal\system_mail_failure_test\Plugin\Mail;
 
-use Drupal\Core\Mail\PhpMail;
+use Drupal\Core\Mail\Plugin\Mail\PhpMail;
 use Drupal\Core\Mail\MailInterface;
 
 /**
@@ -16,16 +16,23 @@
  * This class is for running tests or for development. To use set the
  * configuration:
  * @code
- *   \Drupal::config('system.mail')->set('interface.default', 'Drupal\system_mail_failure_test\TestPhpMailFailure')->save();
+ *   \Drupal::config('system.mail')->set('interface.default', 'test_php_mail_failure')->save();
  * @endcode
+ *
+ * @Mail(
+ *   id = "test_php_mail_failure",
+ *   label = @Translation("Malfunctioning mail backend"),
+ *   description = @Translation("An intentionally broken mail backend, used for tests.")
+ * )
  */
 class TestPhpMailFailure extends PhpMail implements MailInterface {
 
   /**
-   * Overrides Drupal\Core\Mail\PhpMail::mail().
+   * Overrides Drupal\Core\Mail\Plugin\Mail\PhpMail::mail().
+   *
+   * Intentionally fails to send the message.
    */
   public function mail(array $message) {
-    // Instead of attempting to send a message, just return failure.
     return FALSE;
   }
 }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserCreateFailMailTest.php b/core/modules/user/lib/Drupal/user/Tests/UserCreateFailMailTest.php
index 6909667..5a7dabe 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserCreateFailMailTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserCreateFailMailTest.php
@@ -37,7 +37,7 @@ protected function testUserAdd() {
     $this->drupalLogin($user);
 
     // Replace the mail functionality with a fake, malfunctioning service.
-    \Drupal::config('system.mail')->set('interface.default', 'Drupal\system_mail_failure_test\TestPhpMailFailure')->save();
+    \Drupal::config('system.mail')->set('interface.default', 'test_php_mail_failure')->save();
     // Create a user, but fail to send an email.
     $name = $this->randomName();
     $edit = array(
