2.0.0-rc.0 • Published 5 months ago
@fastnloud/nest-mail v2.0.0-rc.0
Description
Mail module for Nest that uses Nodemailer to deliver messages.
Installation
$ npm i --save @fastnloud/nest-mailSetup
Import module:
import { MailModule } from '@fastnloud/nest-mail';
import { Module } from '@nestjs/common';
@Module({
imports: [MailModule],
})
export class AppModule {}A sample .env file looks something like this:
MAIL_DEFAULT_FROM_ADDRESS=john.doe@example.com
MAIL_DEFAULT_FROM_NAME=John Doe
MAIL_RECIPIENTS=
MAIL_URL=smtp://localhost:1025Usage
import { SmtpTransporter } from '@fastnloud/nest-mail';
import { Injectable } from '@nestjs/common';
import { SentMessageInfo } from 'nodemailer';
@Injectable()
export class MailService {
constructor(private readonly smtpTransporter: SmtpTransporter) {}
async send(): Promise<void> {
this.smtpTransporter.send(
{
to: 'jane.doe@example.com',
subject: `hello`,
text: 'world',
},
(error: Error | null, info: SentMessageInfo) => {
if (error) {
throw error;
}
console.log(info);
},
);
}
}License
nest-mail is MIT licensed.
1.1.0
7 months ago
2.0.0-rc.0
5 months ago
1.0.4
1 year ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago
0.0.12
3 years ago
0.0.11
3 years ago
0.0.10
3 years ago
0.0.9
3 years ago
0.0.8
3 years ago
0.0.7
3 years ago
0.0.6
3 years ago
0.0.5
3 years ago
0.0.4
3 years ago
0.0.3
3 years ago
0.0.2
3 years ago
0.0.1
3 years ago