cal/packages/emails/templates/slug-replacement-email.ts
Benny Joo ca78be011c
chore: [app-router-migration-1] migrate the pages in `settings/admin` to the app directory (#12561)
Co-authored-by: Dmytro Hryshyn <dev.dmytroh@gmail.com>
Co-authored-by: DmytroHryshyn <125881252+DmytroHryshyn@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
2023-12-01 13:07:26 -07:00

43 lines
1.1 KiB
TypeScript

import type { TFunction } from "next-i18next";
import { renderEmail } from "..";
import BaseEmail from "./_base-email";
export default class SlugReplacementEmail extends BaseEmail {
email: string;
name: string;
teamName: string | null;
slug: string;
t: TFunction;
constructor(email: string, name: string, teamName: string | null, slug: string, t: TFunction) {
super();
this.email = email;
this.name = name;
this.teamName = teamName;
this.slug = slug;
this.t = t;
}
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
from: `Cal.com <${this.getMailerOptions().from}>`,
to: this.email,
subject: this.t("email_subject_slug_replacement", { slug: this.slug }),
html: await renderEmail("SlugReplacementEmail", {
slug: this.slug,
name: this.name,
teamName: this.teamName || "",
t: this.t,
}),
text: this.getTextBody(),
};
}
protected getTextBody(): string {
return `${this.t("email_body_slug_replacement_notice", { slug: this.slug })} ${this.t(
"email_body_slug_replacement_suggestion"
)}`;
}
}