ooo containing html

This commit is contained in:
2026-04-27 16:35:22 -05:00
parent b03c257de1
commit 31b3fd8c9f
4 changed files with 113 additions and 20 deletions

View File

@@ -135,8 +135,21 @@ mailboxesRouter.get('/:email/rules', async (req, res) => {
mailboxesRouter.put('/:email/rules', async (req, res) => {
const email = normalizeEmail(req.params.email);
ensureDomain(req, domainFromEmail(email));
const body = z.object({ ooo_active: z.boolean().optional(), ooo_message: z.string().optional(), forwards: z.array(z.string().email()).optional() }).parse(req.body);
const saved = await dynamo.putRules({ email_address: email, ooo_active: body.ooo_active, ooo_message: body.ooo_message, forwards: body.forwards });
const body = z.object({
ooo_active: z.boolean().optional(),
ooo_message: z.string().optional(),
// 'text' or 'html'. Stored as-is in DynamoDB so the email worker can
// pick the correct Content-Type when sending the auto-reply.
ooo_content_type: z.enum(['text', 'html']).optional(),
forwards: z.array(z.string().email()).optional(),
}).parse(req.body);
const saved = await dynamo.putRules({
email_address: email,
ooo_active: body.ooo_active,
ooo_message: body.ooo_message,
ooo_content_type: body.ooo_content_type,
forwards: body.forwards,
});
await audit(req.user!.email, 'mailbox.rules_update', 'mailbox', email, saved, req.ip);
res.json(saved);
});