discard plain text renderer
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import previewEmail from "preview-email";
|
||||
|
||||
import { sendEmail } from "integrations/aws-ses";
|
||||
import { render, plaintext } from "./renderer";
|
||||
import { render } from "./renderer";
|
||||
|
||||
type ResetPasswordMailer = {
|
||||
to: string;
|
||||
@ -13,16 +13,12 @@ export async function forgotPasswordMailer({ to, token, userName }: ResetPasswor
|
||||
// In production, set APP_ORIGIN to your production server origin
|
||||
const origin = process.env.APP_ORIGIN || process.env.BLITZ_DEV_SERVER_ORIGIN;
|
||||
const resetUrl = `${origin}/reset-password?token=${token}`;
|
||||
const [html, text] = await Promise.all([
|
||||
render("forgot-password", { action_url: resetUrl, name: userName }),
|
||||
plaintext("forgot-password", { action_url: resetUrl, name: userName }),
|
||||
]);
|
||||
const html = await render("forgot-password", { action_url: resetUrl, name: userName });
|
||||
const msg = {
|
||||
from: "mokhtar@shellphone.app",
|
||||
to,
|
||||
subject: "Reset your password",
|
||||
html,
|
||||
text,
|
||||
};
|
||||
|
||||
return {
|
||||
@ -32,7 +28,6 @@ export async function forgotPasswordMailer({ to, token, userName }: ResetPasswor
|
||||
recipients: [msg.to],
|
||||
subject: msg.subject,
|
||||
html: msg.html,
|
||||
text: msg.text,
|
||||
});
|
||||
} else {
|
||||
// Preview email in the browser
|
||||
|
@ -10,13 +10,6 @@ export async function render(templateName: string, locals: Record<string, string
|
||||
return html;
|
||||
}
|
||||
|
||||
export async function plaintext(templateName: string, locals: Record<string, string> = {}) {
|
||||
const { template, options } = getMaizzleParams(templateName, locals);
|
||||
const { plaintext } = await Maizzle.plaintext(template, options);
|
||||
|
||||
return plaintext;
|
||||
}
|
||||
|
||||
function getMaizzleParams(templateName: string, locals: Record<string, string>) {
|
||||
const template = fs
|
||||
.readFileSync(path.resolve(process.cwd(), "./mailers/templates", `${templateName}.html`))
|
||||
|
Reference in New Issue
Block a user