alterInfo('mail_backend_info'); $this->setCacheBackend($cache_backend, 'mail_backend_plugins'); $this->configFactory = $config_factory; $this->loggerFactory = $logger_factory; $this->stringTranslation = $string_translation; $this->dataCollector = $dataCollector; $this->mailManager = $mailManager; } /** * {@inheritdoc} */ public function mail($module, $key, $to, $langcode, $params = array(), $reply = NULL, $send = TRUE) { $message = $this->mailManager->mail($module, $key, $to, $langcode, $params, $reply, $send); $instance = $this->mailManager->getInstance(['module' => $module, 'key' => $key]); $this->dataCollector->addMessage($message, $instance); return $message; } }