diff --git a/core/modules/user/tests/src/Kernel/UserMailNotifyTest.php b/core/modules/user/tests/src/Kernel/UserMailNotifyTest.php
index a8ac682484..3a68b3d2b5 100644
--- a/core/modules/user/tests/src/Kernel/UserMailNotifyTest.php
+++ b/core/modules/user/tests/src/Kernel/UserMailNotifyTest.php
@@ -93,6 +93,25 @@ public function testUserMailsSent($op, array $mail_keys) {
     $this->assertSameSize($mail_keys, $this->getMails());
   }
 
+  /**
+   * Tests mails are not sent when user does not have the mail.
+   *
+   * @param string $op
+   *   The operation being performed on the account.
+   * @param array $mail_keys
+   *   The mail keys to test for.
+   *
+   * @dataProvider userMailsProvider
+   */
+  public function testUserWithoutMailNotSent($op, array $mail_keys) {
+    $this->installConfig('user');
+    $this->config('user.settings')->set('notify.' . $op, TRUE)->save();
+    $user = $this->createUser();
+    $user->setEmail('')->save();
+    $return = _user_mail_notify($op, $user);
+    $this->assertNull($return);
+  }
+
   /**
    * Tests mails are not sent when notify.$op is FALSE.
    *
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index 62434be638..076b4b07a5 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -1064,7 +1064,10 @@ function _user_mail_notify($op, AccountInterface $account, $langcode = NULL) {
     if (empty($site_mail)) {
       $site_mail = ini_get('sendmail_from');
     }
-    $mail = \Drupal::service('plugin.manager.mail')->mail('user', $op, $account->getEmail(), $langcode, $params, $site_mail);
+    $account_mail = $account->getEmail();
+    if ($account_mail) {
+      $mail = \Drupal::service('plugin.manager.mail')->mail('user', $op, $account_mail, $langcode, $params, $site_mail);
+    }
     if ($op == 'register_pending_approval') {
       // If a user registered requiring admin approval, notify the admin, too.
       // We use the site default language for this.
