Cake 4: Problem with adding base URL to outgoing links in email messages

I have the following line in an email template that creates a link to a document:

$docpath = $this->Html->link($fulltitle, $this->Url->build(['controller'=>'Msrs', 'action'=>'view', $msr_id, 'fullBase' => true]));

Debugging of my environment variables shows that $HTTP_HOST is set correctly, and according to my bootstrap configuration, it should be picked up:

$fullBaseUrl = Configure::read('App.fullBaseUrl');
if (!$fullBaseUrl) {
    $s = null;
if (env('HTTPS')) {
    $s = 's';
}

$httpHost = env('HTTP_HOST');
if (isset($httpHost)) {
    $fullBaseUrl = 'http' . $s . '://' . $httpHost;
}
unset($httpHost, $s);
}
if ($fullBaseUrl) {
    Router::fullBaseUrl($fullBaseUrl);
}
unset($fullBaseUrl);

When the email goes out, however, I only get the document path, not the full URL:

/msrs/view/400

What I need is this:

https://mydomain.com/msrs/view/400

What am I missing? I thought adding fullBase => true would fix this. Do I need to refer to it elsehwere, like my mailer or my controller?

UPDATE: Got it sorted. Had ‘fullBase’ => true in the wrong place. Should look like this:

$docpath = $this->Html->link($fulltitle, $this->Url->build(['controller'=>'Msrs', 'action'=>'view', $msr_id]), ['fullBase' => true]);

I think you don’t need Url->build also. In 3.1 [‘controller’ => “X”, ‘action’ => “y”] does the trick.
https://book.cakephp.org/4/en/views/helpers/html.html#creating-links