protected function sentRegistrationMail()
    {
        $emailConfig = $this->getConfig('email');

        foreach (['bodyTemplate', 'from', 'to', 'subject', 'smtpOptions'] as $option) {
            if (!isset($emailConfig[$option])) {
                throw new InvalidArgumentException("Invalid '{$option}' option for email config");
            }
        }

        $userId = $this->googleClient->getIdToken();
        $email = $this->googleClient->getUserEmail();

        $emailMessageTemplate = $emailConfig['bodyTemplate'];
        $emailMessage = str_replace([':email', ':userId'], [$email, $userId], $emailMessageTemplate);

        $mail = new Message();
        $mail->setBody($emailMessage);

        $mail->setFrom($emailConfig['from']);
        $mail->setSubject($emailConfig['subject']);
        $mail->addTo($emailConfig['to']);

        $transport = new Smtp();
        $options = new SmtpOptions($emailConfig['smtpOptions']);
        $transport->setOptions($options);

        $this->logger->debug(
            json_encode(
                [
                    'Email for registration',
                    'Email body: ' . $emailMessage,
                    'Email from: ' . $emailConfig['from'],
                    'Email subject: ' . $emailConfig['subject'],
                    'Email to: ' . $emailConfig['to'],
                    'Email SMTP options: ' . json_encode($emailConfig['smtpOptions']),
                ]
            )
        );

        $transport->send($mail);
    }