title: Sending Emails in Nestjs
body: <p>I am trying to send email in NestJs but seems to stuck at a weird error.</p>
  <pre class="lang-js prettyprint-override"><code>TypeError: Cannot destructure property 'templateName' of 'precompile(...)' as it is undefined.  
  Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
      at new NodeError (node:internal/errors:363:5)
      at ServerResponse.setHeader (node:_http_outgoing:573:11)
  </code></pre>
  <p>I am not sure what's going on the only solution I was able to find was to put ''./'' in front of the template names but I am not sure why would that work also it isn't even working in my case.</p>
  <p>This is how i am trying to send it</p>
  <pre class="lang-js prettyprint-override"><code>this.mailService.sendEmail(
              emailAddress,
              [], // cc
              [], // bcc
              &quot;Pretty Subject Line&quot;, // subject
              &quot;./verify-email&quot;, // template
              { // context
                  name: &quot;tetsName&quot;,
                  verifyLink
              }
          );
  </code></pre>
  <p>templates folder is in root directory</p>