forked from Yara724/api
Tidied up the packages and unused modules
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
import { Module } from "@nestjs/common";
|
||||
import { MailerModule } from "@nestjs-modules/mailer";
|
||||
import { MailService } from "./mail.service";
|
||||
|
||||
@Module({
|
||||
providers: [MailService],
|
||||
exports: [MailService],
|
||||
imports: [
|
||||
MailerModule.forRoot({
|
||||
transport: {
|
||||
service: "gmail",
|
||||
host: "smtp.gmail.com",
|
||||
port: 465,
|
||||
secure: true,
|
||||
auth: {
|
||||
user: "balali.arash@gmail.com",
|
||||
pass: "macujakosnsqbgdm",
|
||||
},
|
||||
},
|
||||
defaults: {
|
||||
from: "KSG <modules@nestjs.com>",
|
||||
},
|
||||
}),
|
||||
],
|
||||
})
|
||||
export class MailModule {}
|
||||
@@ -1,41 +0,0 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { MailerService } from "@nestjs-modules/mailer";
|
||||
|
||||
@Injectable()
|
||||
export class MailService {
|
||||
constructor(private readonly mailerService: MailerService) {}
|
||||
async sendMail(email, otp: string): Promise<any> {
|
||||
let status: object;
|
||||
await this.mailerService
|
||||
.sendMail({
|
||||
to: email,
|
||||
from: "noreply@yara724.com",
|
||||
subject: "YARA724 Company",
|
||||
text: "welcome",
|
||||
html: `
|
||||
<h1 style="text-align:center">yara724 verificateion </h1>
|
||||
<h3 style="background:#FFA500;width:150px; margin:0 auto; padding:10px; font-size:25px; border-radius:15px; text-align:center;">
|
||||
<div style="color:white">
|
||||
${otp}
|
||||
</div>
|
||||
</h3>
|
||||
`,
|
||||
})
|
||||
.then((success) => {
|
||||
if (success) {
|
||||
status = {
|
||||
message: "email was sent successfully",
|
||||
code: 200,
|
||||
emailSent: true,
|
||||
};
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err) {
|
||||
status = { message: "please try again", code: 500, emailSent: false };
|
||||
}
|
||||
});
|
||||
|
||||
return status;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user