1

My Question is already present here but the previously given answer for my question can applied to Drupal 7 and I can not use the same solution in Drupal 8.

I hope it is okay not put the same question once again.

2

Bingo! Found the Solution myself:

    function custom_module_mail_alter(&$message) {
      if (!empty($message['id']) && $message['id'] == 'user_password_reset') {
        $token_service = \Drupal::token();
        $language_interface = \Drupal::languageManager()->getCurrentLanguage();
        $account = $message['params']['account'];  
        $one_time_url_token = '[user:one-time-login-url]';  
        $one_time_url = $token_service->replace($one_time_url_token, ['user' => $account], ['langcode' => $language_interface->getId(), 'callback' => 'user_mail_tokens', 'clear' => TRUE]);  
      }
    }
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.