Why does swiftmailer doesn't use my HTML template? In some form of my custom module, a condition triggers an email to be sent:  

  public function save(array $form, FormStateInterface $form_state) {
    $entity = $this-&gt;entity;
    $status = parent::save($form, $form_state);
    $values=$form_state-&gt;getValues();
    if (($values['isurgent']['value']==1) &amp;&amp; ($values['status']['value']==1)) {
      $iSeliste = \Drupal::currentUser()-&gt;id();
      $oSeliste = \Drupal::entityTypeManager()-&gt;getStorage('person')-&gt;load($iSeliste);
      $sSelite = $oSeliste-&gt;firstname-&gt;value . " " . $oSeliste-&gt;lastname-&gt;value;
      $sAction = ($values['action'][0]['value']==0)?"offre":"demande";
      $sDueDate = $values['duedate'][0]['value']-&gt;format("d/m/Y");
      _sendEmailForUrgentService($sSelite, $sAction, $sDueDate);
    }


in sel.module:  

function _sendEmailForUrgentService($sSeliste, $sAction, $sDueDate) {
...some code...
  \Drupal::service('plugin.manager.mail')-&gt;mail('sel', 'emailforurgentservice', $sTo, 'fr',      $params);
  \Drupal::logger('sel')-&gt;info('Courriel pour service urgent : envoi effectué.');
}


my hook_mail:  

function sel_mail($key, &amp;$message, $params) {
  $sFrom = '[redacted]';
  $message['from'] = $sFrom;
  $message['headers'] = array(
    'Content-Type' =&gt; 'text/html',
    'bcc' =&gt; $params[3],
    'From' =&gt; $sFrom,
    'Sender' =&gt; $sFrom,
    'Return-Path' =&gt; $sFrom,
  );
  switch ($key) {
    case 'emailforurgentservice':
      $message['subject'] = '[Le Grenier à SÉL] Un service urgent requiert votre attention...';
      $sBody  = $params[0] . " a posté une " . $params[1] . " urgente qui est valide jusqu'au " . $params[2] . ".";
      $message['body'][] = check_markup(nl2br($sBody), 'full_html');
      break;
  }
}


The settings of mailsystem are these:


And in my theme templates folder (mysite/web/themes/contrib/mayo/templates/), there is my email template swiftmailer--sel--emailforurgentservice.html.twig:  

&lt;html&gt;
&lt;head&gt;
    &lt;style type="text/css"&gt;     table tr td {
          font-family: Candara;
          font-size: 14px;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;
    &lt;table width="800px" cellpadding="0" cellspacing="0"&gt;
        &lt;tr&gt;
            &lt;td&gt;
            &lt;div style="padding: 0px 0px 0px 0px;"&gt;
                &lt;p&gt;
                    Chers S&amp;Eacute;Listes,&lt;br&gt;&lt;br&gt;
                    {{ body }} &lt;br&gt;
                    Vous pouvez la consulter &lt;a href="http://lejardindepoissy.org/?q=sel_catalogue\"&gt;ici&lt;/a&gt;.";&lt;br&gt;
                    Si vous ne la trouvez pas, c'est peut-être qu'elle a d&amp;eacute;j&amp;agrave; &amp;eacute;t&amp;eacute; satisfaite.";&lt;br&gt;&lt;br&gt;
                    --&lt;br&gt;
                    Le Grenier à S&amp;Eacute;L
                &lt;/p&gt;
            &lt;/div&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;


The email is sent. Everything is OK (From, To, Bcc, Subject) except the body!
Instead what I defined in the template, I have only the content of $sBody as defined in function sel_mail().
Any idea what I am doing wrong?
My mistake!
I put my email template swiftmailer--sel--emailforurgentservice.html.twig in "mayo" theme which is the theme the users of the site will see.
Mailsystem was set to use "current" theme.
When I made my tests, I did it as 'user 1' and the theme when the email was triggered was "Seven" (Administration theme).
I changed the settings of Maisystem:

And it works as expected!