chore: more email validation
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user