# Email and Templates

### All templates path

<pre><code>├── node_modules
<strong>├── mail-templates
</strong>│   ├── account-created.pug            # When account is created
│   ├── failed-payment.pug             # When a subscription renew failed
│   ├── reset-password.pug             # When user request lost password
│   ├── success-payment.pug            # When a payment is successfully
<strong>│   ├── updated-subscription.pug       # When user change subscription       
</strong></code></pre>

### Set up Email environment variables in <mark style="color:blue;">.env</mark>

```
# MAILING
SMTP_HOST=
SMTP_PORT=
SMTP_SECURE=false
SMTP_AUTH=
SMTP_PASSWORD=
SMTP_FROM='"Support name" <support@domain.name>'
MODERATION_MAIL=
```

### How To send a email?

```typescript
// import user service
import { UsersService } from 'src/domains/users/users.service';
constructor(private readonly usersService: UsersService) {}

// call send email to user
await this.usersService.sendMailToUser(...)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nzoni.app/nest.js/email-and-templates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
