code: public function changeEmail($data)
      {
          /* @var $user UserInterface */
          if (!($user = $this->hydrate($data, $this->getChangeEmailForm()))) {
              return;
          }
  
          $eventManager = $this->getEventManager();
          $eventManager->trigger(__METHOD__, $this, $user);
  
          $user->setEmailConfirmed(false);
  
          $viewModel = new ViewModel(compact('user'));
          $viewModel->setTemplate('mail-message/user-confirm-email');
  
          $mailService = $this->getMailService();
          $message = $mailService->getMessage();
          $message->setTo($user->getEmail(), $user->getDisplayName());
  
          $subject = 'Please, confirm your email!';
          if ($this->getTranslator() && $this->isTranslatorEnabled()) {
              $subject = $this->getTranslator()->translate(
                  $subject,
                  $this->getTranslatorTextDomain()
              );
          }
          $message->setSubject($subject);
  
          $mailService->setBody($viewModel)->sendMessage();
  
          $this->getMapper()->update($user)->save();
  
          $eventManager->trigger(__METHOD__ . '.post', $this, $user);
  
          return $user;
      }
docs: Change user email
  
  @param array|UserInterface $data
  @return UserInterface|void