chore: more email validation

This commit is contained in:
Rotimi Best
2025-12-03 07:31:35 +01:00
parent 1e966aaf0f
commit f2b719cd1b
+8
View File
@@ -13,6 +13,14 @@ export const mailRouter = new Hono().post(
const results = await Promise.all(
validatedData.map(async (emailData) => {
if (emailData.to && /.+@test\..+/.test(emailData.to)) {
throw new Error('Sending from test.com addresses is not allowed');
}
if (!emailData.from?.includes('<[email protected]>')) {
throw new Error('Emails must be sent from a @mail.classroomio.com address');
}
try {
const res = env.ZOHO_TOKEN
? await sendWithZoho(emailData)