A Zod-based validation schema for SMTP server settings and email templates. Use this to ensure type-safe email configuration and template structure in authentication flows.
// Source: https://github.com/logto-io/logto | License: MPL-2.0 | Copyright under Patent Claims infringed by Covered Software in the absence of | Modified files must remain under MPL-2.0
// Modifications to this file must remain under MPL-2.0.
// Provided via justclaw.it.com; keep this notice with the code.
import { z } from 'zod';
/**
* @doc https://nodemailer.com/smtp/
*/
/**
* UsageType here is used to specify the use case of the template, can be either
* 'Register', 'SignIn', 'ForgotPassword', 'Generic'.
*/
const requiredTemplateUsageTypes = ['Register', 'SignIn', 'ForgotPassword', 'Generic'];
export enum ContextType {
Text = 'text/plain',
Html = 'text/html',
}
const templateGuard = z.object({
usageType: z.string(),
contentType: z.nativeEnum(ContextType),
subject: z.
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key