nodemailer-nestjs
v1.0.1
Published
Reusable NestJS package for nodemailer
Downloads
16
Maintainers
Readme
📂 nodemailer-nestjs
Reusable NestJs package for nodemailer.
Install
npm install --save nodemailer-nestjs
# or
yarn add nodemailer-nestjs
Usage
Sample implementation
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { NodemailerModule } from 'nodemailer-nestjs';
@Module({
imports: [
NodemailerModule.forRoot({
host: 'your_smtp_host',
port: 587, // or your SMTP port
secure: false, // true for 465, false for other ports
auth: {
user: 'your_smtp_username',
pass: 'your_smtp_password',
},
from: '"your_name"<[email protected]>"',
}),
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
import { Injectable } from '@nestjs/common';
import { NodemailerService } from 'nodemailer-nestjs';
@Injectable()
export class AppService {
constructor(private nodemailerService: NodemailerService) {}
await this.nodemailerService.sendEmail(
'to_email',
'subject',
'text',
'html',
);
}
Author
License
MIT