EmailRouteValidator (validation/email.ts)

strapi · packages/core/email/server/src/routes/validation/email.ts · typescript · MIT
email

Zod schema validator for email send route input and response in Strapi.

// Source: https://github.com/strapi/strapi | License: MIT | Copyright 2015-present Strapi Solutions SAS
// Provided via justclaw.it.com; keep this notice with the code.
import type { Core } from '@strapi/types';
import * as z from 'zod/v4';

export class EmailRouteValidator {
  protected readonly _strapi: Core.Strapi;

  public constructor(strapi: Core.Strapi) {
    this._strapi = strapi;
  }

  get sendEmailInput() {
    return z
      .object({
        from: z.string().optional(),
        to: z.string(),
        cc: z.string().optional(),
        bcc: z.string().optional(),
        replyTo: z.string().optional(),
        subject: z.string(),
        text: z.string(),
        html: z.string().optional(),
      })
      .catchall(z.string());
  }

  get emailResponse() {
    return z.obje

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key