From dff76010d9ce76ae1e27c614ad0fee14605372e1 Mon Sep 17 00:00:00 2001 From: Igor Propisnov Date: Tue, 10 Sep 2024 22:15:06 +0200 Subject: [PATCH] Added E-Mail --- .../services/password-confirmation.mail.service.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/src/modules/sendgrid-module/services/password-confirmation.mail.service.ts b/backend/src/modules/sendgrid-module/services/password-confirmation.mail.service.ts index 79db592..939dd70 100644 --- a/backend/src/modules/sendgrid-module/services/password-confirmation.mail.service.ts +++ b/backend/src/modules/sendgrid-module/services/password-confirmation.mail.service.ts @@ -10,6 +10,7 @@ import { TemplateConfigService } from './template-config.service'; export class PasswordConfirmationMailService extends BaseMailService { private readonly PASSWORD_CONFIRMATION_EMAIL: string = 'PASSWORD_CONFIRMATION_EMAIL'; + private readonly REGISTER_EMAIL: string = 'REGISTER_EMAIL'; public constructor( @Inject('SEND_GRID_API_KEY') protected readonly sendGridApiKey: string, @@ -66,13 +67,17 @@ export class PasswordConfirmationMailService extends BaseMailService { ): Promise { const token = `${registrationToken}|${UriEncoderService.encodeBase64(to)}`; const registrationLink = `${this.configService.get('APP_URL')}/?token=${token}&signup=true`; + const templateId: string = this.templateConfigService.getTemplateId( + this.REGISTER_EMAIL + ); const mailoptions: SendGridMailApi.MailDataRequired = { to, from: { email: 'info@igor-propisnov.com', name: 'Ticket App' }, - subject: 'Complete Your Registration', - text: `Click this link to complete your registration: ${registrationLink}`, - html: `

Click here to complete your registration.

`, + templateId: templateId, + dynamicTemplateData: { + buttonUrl: registrationLink, + }, }; await this.sendMail(mailoptions);