Added E-Mail
This commit is contained in:
parent
9e543a00eb
commit
dff76010d9
|
@ -10,6 +10,7 @@ import { TemplateConfigService } from './template-config.service';
|
||||||
export class PasswordConfirmationMailService extends BaseMailService {
|
export class PasswordConfirmationMailService extends BaseMailService {
|
||||||
private readonly PASSWORD_CONFIRMATION_EMAIL: string =
|
private readonly PASSWORD_CONFIRMATION_EMAIL: string =
|
||||||
'PASSWORD_CONFIRMATION_EMAIL';
|
'PASSWORD_CONFIRMATION_EMAIL';
|
||||||
|
private readonly REGISTER_EMAIL: string = 'REGISTER_EMAIL';
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
@Inject('SEND_GRID_API_KEY') protected readonly sendGridApiKey: string,
|
@Inject('SEND_GRID_API_KEY') protected readonly sendGridApiKey: string,
|
||||||
|
@ -66,13 +67,17 @@ export class PasswordConfirmationMailService extends BaseMailService {
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const token = `${registrationToken}|${UriEncoderService.encodeBase64(to)}`;
|
const token = `${registrationToken}|${UriEncoderService.encodeBase64(to)}`;
|
||||||
const registrationLink = `${this.configService.get<string>('APP_URL')}/?token=${token}&signup=true`;
|
const registrationLink = `${this.configService.get<string>('APP_URL')}/?token=${token}&signup=true`;
|
||||||
|
const templateId: string = this.templateConfigService.getTemplateId(
|
||||||
|
this.REGISTER_EMAIL
|
||||||
|
);
|
||||||
|
|
||||||
const mailoptions: SendGridMailApi.MailDataRequired = {
|
const mailoptions: SendGridMailApi.MailDataRequired = {
|
||||||
to,
|
to,
|
||||||
from: { email: 'info@igor-propisnov.com', name: 'Ticket App' },
|
from: { email: 'info@igor-propisnov.com', name: 'Ticket App' },
|
||||||
subject: 'Complete Your Registration',
|
templateId: templateId,
|
||||||
text: `Click this link to complete your registration: ${registrationLink}`,
|
dynamicTemplateData: {
|
||||||
html: `<p>Click <a href="${registrationLink}">here</a> to complete your registration.</p>`,
|
buttonUrl: registrationLink,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
await this.sendMail(mailoptions);
|
await this.sendMail(mailoptions);
|
||||||
|
|
Loading…
Reference in New Issue