shellphone.app/app/mailers/forgot-password-mailer.server.ts

22 lines
581 B
TypeScript
Raw Normal View History

2022-05-14 10:22:06 +00:00
import sendEmail from "~/utils/mailer.server";
import serverConfig from "~/config/config.server";
import { render } from "./renderer/renderer.server";
type Params = {
to: string;
token: string;
userName: string;
};
export async function sendForgotPasswordEmail({ to, token, userName }: Params) {
const origin = serverConfig.app.baseUrl;
const resetUrl = `${origin}/reset-password?token=${token}`;
const html = await render("forgot-password", { action_url: resetUrl, name: userName });
return sendEmail({
recipients: to,
subject: "Reset your password",
html,
});
}