diff --git a/src/MailsystemManager.php b/src/MailsystemManager.php
index f7486b0..0fe4383 100644
--- a/src/MailsystemManager.php
+++ b/src/MailsystemManager.php
@@ -15,10 +15,9 @@ use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Logger\LoggerChannelFactoryInterface;
 use Drupal\Core\Mail\MailInterface;
 use Drupal\Core\Mail\MailManager;
+use Drupal\Core\Render\RendererInterface;
 use Drupal\Core\StringTranslation\TranslationInterface;
-use Drupal\Core\Theme\Registry;
 use Drupal\Core\Theme\ThemeInitializationInterface;
-use Drupal\Core\Theme\ThemeManager;
 use Drupal\Core\Theme\ThemeManagerInterface;
 
 /**
@@ -46,10 +45,35 @@ class MailsystemManager extends MailManager {
   protected $themeInitialization;
 
   /**
-   * {@inheritdoc}
+   * Constructs the MailManager object.
+   *
+   * @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\Extension\ModuleHandlerInterface $module_handler
+   *   The module handler to invoke the alter hook with.
+   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
+   *   The configuration factory.
+   * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_factory
+   *   The logger channel factory.
+   * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
+   *   The string translation service.
+   * @param \Drupal\Core\Theme\ThemeManagerInterface $theme_manager
+   *   The theme manager.
+   * @param \Drupal\Core\Theme\ThemeInitializationInterface $theme_initialization
+   *   The theme initialization.
+   * @param \Drupal\Core\Render\RendererInterface $renderer
+   *   The renderer (argument included since Core 8.2 and later versions).
    */
-  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, ConfigFactoryInterface $config_factory, LoggerChannelFactoryInterface $logger_factory, TranslationInterface $string_translation, ThemeManagerInterface $theme_manager, ThemeInitializationInterface $theme_initialization) {
-    parent::__construct($namespaces, $cache_backend, $module_handler, $config_factory, $logger_factory, $string_translation);
+  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, ConfigFactoryInterface $config_factory, LoggerChannelFactoryInterface $logger_factory, TranslationInterface $string_translation, ThemeManagerInterface $theme_manager, ThemeInitializationInterface $theme_initialization, RendererInterface $renderer) {
+    if (version_compare(\Drupal::VERSION, '8.2', '<')) {
+      parent::__construct($namespaces, $cache_backend, $module_handler, $config_factory, $logger_factory, $string_translation);
+    }
+    else {
+      parent::__construct($namespaces, $cache_backend, $module_handler, $config_factory, $logger_factory, $string_translation, $renderer);
+    }
     $this->themeManager = $theme_manager;
     $this->themeInitialization = $theme_initialization;
   }
