You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
842 B
TypeScript
28 lines
842 B
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import { MailerService } from '@nest-modules/mailer';
|
|
import * as config from 'config';
|
|
|
|
const mail= config.get('mail');
|
|
|
|
@Injectable()
|
|
export class EmailService {
|
|
constructor(
|
|
private readonly mailerService: MailerService
|
|
) { }
|
|
// documenation : https://www.npmjs.com/package/@nest-modules/mailer
|
|
|
|
async sendMail(toMail:string,subject:string,bodyText: string,htmlText:string){
|
|
this.mailerService.sendMail({
|
|
to: toMail, // sender addressject: subject, // Subject line
|
|
text: bodyText, // plaintext body
|
|
html: htmlText, // HTML body content
|
|
})
|
|
.then((res) => {
|
|
console.log("==== here==res==", res)
|
|
})
|
|
.catch((err) => {
|
|
console.log("=====err====", err);
|
|
});
|
|
}
|
|
}
|