From 5638fc194d415c35fffdd05e71690449afef14cc Mon Sep 17 00:00:00 2001 From: wouerner Date: Fri, 28 Jun 2024 11:48:38 -0300 Subject: [PATCH] add news config to email e envs links --- src/modules/mails/mail.module.ts | 11 ++++++----- src/modules/mails/mail.service.ts | 11 +++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/modules/mails/mail.module.ts b/src/modules/mails/mail.module.ts index 3362e96..656fb3a 100644 --- a/src/modules/mails/mail.module.ts +++ b/src/modules/mails/mail.module.ts @@ -13,17 +13,18 @@ import { MailService } from './mail.service'; transport: { host: config.get('MAIL_HOST'), port: config.get('MAIL_PORT'), - secure: true, + // secure: true, + // secure: false, auth: { user: config.get('MAIL_USER'), pass: config.get('MAIL_PASSWORD'), }, - tls: { - rejectUnauthorized: false, - }, + // tls: { + // rejectUnauthorized: false, + // }, }, defaults: { - from: `no-reply `, + from: `no-reply `, }, template: { dir: join(__dirname, 'templates'), diff --git a/src/modules/mails/mail.service.ts b/src/modules/mails/mail.service.ts index cc49f90..ba725b1 100644 --- a/src/modules/mails/mail.service.ts +++ b/src/modules/mails/mail.service.ts @@ -9,7 +9,10 @@ export class MailService { async sendUserConfirmation(user: UsersEntity): Promise { const { email, name, recoverPasswordToken } = user; - const url = `https://vagas-front-end.netlify.app/recovery-password?token=${recoverPasswordToken}&type=USER`; + // const url = `https://vagas-front-end.netlify.app/recovery-password?token=${recoverPasswordToken}&type=USER`; + const url = `${process.env.FRONTEND_URL}/recovery-password?token=${recoverPasswordToken}&type=USER`; + + if (recoverPasswordToken) { await this.mailerService.sendMail({ @@ -37,7 +40,7 @@ export class MailService { async sendUserCreationConfirmation(user: UsersEntity) { const { email, name, id } = user; - const url = `https://vagas-front-end.netlify.app/userconfirmation?id=${id}&type=USER`; + const url = `${process.env.FRONTEND_URL}/userconfirmation?id=${id}&type=USER`; await this.mailerService.sendMail({ to: email, @@ -54,7 +57,7 @@ export class MailService { async sendCompanyConfirmation(company: CompaniesEntity) { const { email, companyName, recoverPasswordToken } = company; - const url = `https://vagas-front-end.netlify.app/recovery-password?token=${recoverPasswordToken}&type=COMPANY`; + const url = `${process.env.FRONTEND_URL}/recovery-password?token=${recoverPasswordToken}&type=COMPANY`; if (recoverPasswordToken) { await this.mailerService.sendMail({ @@ -81,7 +84,7 @@ export class MailService { async sendCompanyCreationConfirmation(company: CompaniesEntity) { const { email, companyName, id } = company; - const url = `https://vagas-front-end.netlify.app/companyconfirmation?id=${id}&type=COMPANY`; + const url = `${process.env.FRONTEND_URL}/companyconfirmation?id=${id}&type=COMPANY`; await this.mailerService.sendMail({ to: email,