Email and Templates

All templates path

├── node_modules
├── mail-templates
│   ├── 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
│   ├── updated-subscription.pug       # When user change subscription       

Set up Email environment variables in .env

# 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?

// 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(...)

Last updated