emails – Sending form to mail from custom module fails without error


I’ve created a module with a form and a block.

When I push the subscribe button, the submitForm function is executed.

The successmessage is shown, but no e-mail is send …

There are no errors reported in the recent logmessages or in on the server in the folder /logs.

public function submitForm(array &$form, FormStateInterface $form_state)
    {
        /**
         * @var MailManager $mailer
         */
        $mailer = Drupal::service('plugin.manager.mail');

        $email = $form_state->getValue('email');
        $params('context')('subject') = "Subscribe newsletter";
        $params('context')('message') = 'Someone subscribed: ' . $email;
        $params('email') = $email;

        try {
            $response = $mailer->mail('my_module', 'subscribe', 'to@email.com', 'nl', $params);
            if ($response) {
                $this->messenger()->addStatus($this->t('You are successfully subscribed to our newsletter with your e-mail: @email', ('@email' => $email)));
            } else {
                $this->messenger()->addStatus($this->t('There was an error.'));
            }
        } catch (MailHandlerException $e) {
            Drupal::logger('mailinglist_send_mail_error')->notice('<pre><code>' . print_r($e, true) . '</code></pre>');
        }

    }