1.0.2 • Published 3 years ago

@afaqy/mailer v1.0.2

Weekly downloads
-
License
GNU
Repository
github
Last release
3 years ago

Mailer

This is a small package that enables NestJS developers to have a local mail client via simple configurations

Installation

npm i @afaqy/mailer

In your app module

import { MailerModule } from '@afaqy/mailer';

imports: [
    MailerModule.forRoot({
        user: string, // email@example.com
        password: string, // your email's password
        host: string, // localhost
        port: number, // 565
    })
]

Usage

import { MailerService } from '@afaqy/mailer';

@Injectable()
export class appService {
    constructor(private mailer: MailerService) {}
  
    async forgetPassword(user) {
        const emailPayload = {
            receiver: user.email,
            subject: "Reset password link",
            body: "HTML_STRING",
            from: "YOUR_APP_NAME <YOUR_EMAIL>",
        };
        try {
            await this.mailer.sendEmail(emailPayload);
        } catch(e) {
            console.log(e);
        }
    }
}
1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago