Mail subject and body remain empty using mailManager I have been fiddling with sending a mail in my custom module in Drupal 8.
The mail gets sent but the subject and body are empty. 
It has been an issue for days and I can't get it to work. The code and var_dump are below. I just can't find the issue. Maybe someone can! 

Code in hook_mail:

&lt;?php
/**
 * Implements hook_mail().
 */
function document_mail($key, $message, $params)
{
    $options = array(
        'langcode' =&gt; $message['langcode'],
    );
    switch ($key) {
       case 'send_file':
            $message['from'] = \Drupal::config('system.site')-&gt;get('mail');
            $message['subject'] = t('@title', array('@title' =&gt; $params['mail_title']), $options);
            $message['body'][] = $params['message'];
        break;
    }
}


Code to send mail:

    $mailManager = \Drupal::service('plugin.manager.mail');
    $module = 'document';
    $key = 'send_file';
    $to = 'info@example.com';
    $params['mail_title'] = 'a title';
    $params['message'] = 'a message';
    $langcode = \Drupal::currentUser()-&gt;getPreferredLangcode();
    $send = true;
    $result = $mailManager-&gt;mail($module, $key, $to, $langcode, $params, null, $send);
    var_dump($result);
    if ($result['result'] !== true) {
        drupal_set_message(t('There was a problem sending your message and it was not sent.'), 'error');
    } else {
        drupal_set_message(t('Your message has been sent.'));
    }


var_dump of result from $result of mailManager

array(12) { 
["id"]=&gt; string(18) "document_send_file" 
["module"]=&gt; string(8) "document" 
["key"]=&gt; string(9) "send_file" 
["to"]=&gt; string(24) "info@example.com," 
["from"]=&gt; string(22) "info@example.com" 
["reply-to"]=&gt; NULL 
["langcode"]=&gt; string(2) "en" 
["params"]=&gt; array(2) 
{ 
    ["mail_title"]=&gt; string(7) "a title" 
    ["message"]=&gt; string(9) "a message" 
} 
["send"]=&gt; bool(true) 
["subject"]=&gt; object(Drupal\Core\StringTranslation\TranslatableMarkup)#410 (5) 
{ 
    ["string":protected]=&gt; string(6) "@title" 
        ["translatedMarkup":protected]=&gt; NULL 
        ["options":protected]=&gt; array(1) 
        { 
                ["langcode"]=&gt; string(2) "en" 
        } 
        ["stringTranslation":protected]=&gt; NULL 
        ["arguments":protected]=&gt; array(1) 
        { 
            ["@title"]=&gt; string(7) "a title" 
        } 
    } 
    ["body"]=&gt; array(1) 
    { 
        [0]=&gt; string(9) "a message" 
    } 
    ["headers"]=&gt; array(7) 
    { 
        ["MIME-Version"]=&gt; string(3) "1.0" 
        ["Content-Type"]=&gt; string(51) "text/plain; charset=UTF-8; format=flowed; delsp=yes" 
        ["Content-Transfer-Encoding"]=&gt; string(4) "8Bit" 
        ["X-Mailer"]=&gt; string(6) "Drupal" 
        ["Return-Path"]=&gt; string(22) "info@example.com" 
        ["Sender"]=&gt; string(22) "info@example.com" 
        ["From"]=&gt; string(44) "a string" 
    }
    ["result"]=&gt; bool(true)
}
Remove the empty array tag from body as below.

$message['body'] = $params['message'];