View / PhpRenderer - Template Maps und Template Path Stacks from Module's config not included?

In my Module’s Config I have set template map’s and path stack:

Mail/config/module.config.php

return [
    'view_manager' => [
        'template_map' => [
            'test/index' => __DIR__ . '/../view/mail/test/index.phtml',    
        ],
        'template_path_stack' => [
            'mail' => __DIR__ . '/../view/',
        ],
    ],
];

But it looks like that this configuration is not included if I call the PhpRenderer() manually:

Mail.php Class

<?php

class Mail {

    protected $renderer;       
    protected $mailHtmlView;   

    public function render()
    {
        $this->renderer      = new PhpRenderer();
        $this->mailHtmlView  = new ViewModel();

        $this->mailHtmlView->setTemplate('xyz');
        $res = $this->renderer->render($this->mailHtmlView);
    }

Always ends up in error:

Laminas\View\Renderer\PhpRenderer::render: Unable to render template "xyz"; resolver could not resolve to a file

It looks like if using the PhpRenderer it doesn’t include the Modules Config. How can I make the Template Map and Template Stack which is included in the Module’s config available to the PhpRenderer() ?

If you need “default” renderer with application config, create constructor (or setter) in Mail class and pass ViewRenderer into property.

class Mail {

    public $viewRenderer;

    public function __construct($renderer)
    {
        $this->viewRenderer = $renderer;
    }

    public function render()
    {
     
        $html = $this->viewRenderer->render('order/tour/message',
            array(
                'order' => $order
            ));
    }
...

Class MailFactory

...
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
    {
        return new Mail($container->get('ViewRenderer'));
    }
...