How to set view path for rendering email templates? Trying to send an email

Craft::$app-&gt;setViewPath('/Users/stian/dev/site.com/templates/');
Craft::$app-&gt;mailer-&gt;compose('confirmation.twig', ['orderId' =&gt; $orderId, 'customerId' =&gt; $customerId])
    -&gt;setFrom('me@me.com')
    -&gt;setTo('me@me.com')
    -&gt;setSubject('hey')
    -&gt;send();


Getting The view file does not exist: /Users/stian/dev/site.com/vendor/craftcms/cms/src/mail/confirmation.twig

Assuming I correctly understand how to render a view for sending as an email, how can I correctly point to its location?
For anyone struggling with this, apparently this is one way of doing it.

I struggled with this for quite some time before posting my original question, but regardless, sorry about that.

Anyway, here it is.

Craft::$app-&gt;setViewPath('/path/to/templates/');
$body = Craft::$app-&gt;getView()-&gt;renderTemplate('confirmation.twig', ['orderId' =&gt; $orderId, 'customerId' =&gt; $customerId]);
Craft::$app-&gt;mailer-&gt;compose()
    -&gt;setFrom(['me@me.com')
    -&gt;setTo('me@me.com')
    -&gt;setSubject('hey')
    -&gt;setHtmlBody($body)
    -&gt;send();


Edit:

There's probably a better way of doing this, but if you're working in multiple environments, you can do this in general.php

'dev' =&gt; [
    'templatePath' =&gt; '/Users/stian/dev/site.com/templates/',
],
'staging' =&gt; [
    'templatePath' =&gt; '/Users/stian/dev/site.com/templates/',
],
etc


and then Craft::$app-&gt;setViewPath(Craft::$app-&gt;config-&gt;general-&gt;templatePath) in your plugin/module.

PS! Will mark as answered once I'm allowed