import * as z from 'zod'; import { defineEmail } from '../send'; import { getDefaultTemplate } from '../templates'; export const verifyEmailEmail = defineEmail({ id: 'verifyEmail', subject: 'Action Required: Confirm your email', schema: z.object({ link: z.url(), newEmail: z.email().optional(), userName: z.string().optional() }), render: (fields) => { const isEmailChange = !!fields.newEmail; const userName = fields.userName || 'there'; const content = isEmailChange ? `

Hey ${userName} 👋

You have requested to change your email address to ${fields.newEmail}.

To approve this change, please click the button below:

Approve Email Change

If you did not request this change, please ignore this email.

` : `

Hey ${userName} 👋

Welcome to ClassroomIO! In order to get your account ready for usage, we need to verify your email.

We do this to make sure we don't get fake user emails in our signup. To get the best out of our product, we'll need you to verify your email by clicking the Verify button below

Verify
`; return getDefaultTemplate(content); } });