diff --git a/core/lib/Drupal/Core/Mail/MalPhpMail.php b/core/lib/Drupal/Core/Mail/MalPhpMail.php
new file mode 100644
index 0000000..f55cebc
--- /dev/null
+++ b/core/lib/Drupal/Core/Mail/MalPhpMail.php
@@ -0,0 +1,23 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\Core\Mail\MalPhpMail.
+ */
+
+namespace Drupal\Core\Mail;
+
+/**
+ * Defines a mail sending implementation that return false.
+ *
+ * This class is for running tests or for development.
+ */
+class MalPhpMail extends PhpMail implements MailInterface {
+
+  /**
+   * Overrides Drupal\Core\Mail\PhpMail::mail().
+   */
+  public function mail(array $message) {
+    return FALSE;
+  }
+}
diff --git a/core/modules/user/lib/Drupal/user/RegisterFormController.php b/core/modules/user/lib/Drupal/user/RegisterFormController.php
index 2a84412..f84a3df 100644
--- a/core/modules/user/lib/Drupal/user/RegisterFormController.php
+++ b/core/modules/user/lib/Drupal/user/RegisterFormController.php
@@ -131,13 +131,14 @@ public function save(array $form, array &$form_state) {
       }
       else {
         $op = $notify ? 'register_admin_created' : 'register_no_approval_required';
-        _user_mail_notify($op, $account);
-        if ($notify) {
-          drupal_set_message(t('A welcome message with further instructions has been e-mailed to the new user <a href="@url">%name</a>.', array('@url' => url($uri['path'], $uri['options']), '%name' => $account->name)));
-        }
-        else {
-          drupal_set_message(t('A welcome message with further instructions has been sent to your e-mail address.'));
-          $form_state['redirect'] = '';
+        if (_user_mail_notify($op, $account)) {
+          if ($notify) {
+            drupal_set_message(t('A welcome message with further instructions has been e-mailed to the new user <a href="@url">%name</a>.', array('@url' => url($uri['path'], $uri['options']), '%name' => $account->name)));
+          }
+          else {
+            drupal_set_message(t('A welcome message with further instructions has been sent to your e-mail address.'));
+            $form_state['redirect'] = '';
+          }
         }
       }
     }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserCreateFailMailTest.php b/core/modules/user/lib/Drupal/user/Tests/UserCreateFailMailTest.php
new file mode 100644
index 0000000..abd53c5
--- /dev/null
+++ b/core/modules/user/lib/Drupal/user/Tests/UserCreateFailMailTest.php
@@ -0,0 +1,53 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\user\Tests\UserCreateFailMailTest.
+ */
+
+namespace Drupal\user\Tests;
+
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Test the create user administration page.
+ */
+class UserCreateFailMailTest extends WebTestBase {
+
+  public static function getInfo() {
+    return array(
+      'name' => 'User create with failed mail function',
+      'description' => 'Test the create user administration page.',
+      'group' => 'User',
+    );
+  }
+
+  /**
+   * Create a user through the administration interface and ensure that it
+   * displays proper message when mail does not work.
+   */
+  protected function testUserAdd() {
+    $user = $this->drupalCreateUser(array('administer users'));
+    $this->drupalLogin($user);
+
+    // We stop mail function
+    $mail_system_variable = config('system.mail')->get('interface.default');
+    config('system.mail')->set('interface.default', 'Drupal\Core\Mail\MalPhpMail')->save();
+    // We create a user, notify the created user and fail to send email.
+    $name = $this->randomName();
+    $edit = array(
+      'name' => $name,
+      'mail' => $this->randomName() . '@example.com',
+      'pass[pass1]' => $pass = $this->randomString(),
+      'pass[pass2]' => $pass,
+      'notify' => true,
+    );
+    $this->drupalPost('admin/people/create', $edit, t('Create new account'));
+
+    $this->assertText(t('Unable to send e-mail. Contact the site administrator if the problem persists.'),'Error message for disfunctional mail.');
+    $this->assertNoText(t('A welcome message with further instructions has been e-mailed to the new user @name.', array('@name' => $edit['name'])), 'Do not show welcome message');
+
+    // Set the old variable back.
+    config('system.mail')->set('interface.default', $mail_system_variable)->save();
+  }
+}
