Render inbound email HTML body in admin inbox

Worker now extracts both text/plain and text/html MIME parts and sends
htmlBody in the webhook payload. Server stores it on the submission.
Admin inbox renders htmlBody in a sandboxed iframe when present, falling
back to plain text with whitespace preserved.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
nmemmert
2026-06-30 11:32:52 -04:00
parent 4b411f763f
commit 118314d0d7
3 changed files with 33 additions and 16 deletions
+2 -1
View File
@@ -15,7 +15,7 @@ export function register(app) {
res.status(401).json({ message: 'Unauthorized.' }); return
}
const { from, to, subject, body, date, messageId, source } = req.body ?? {}
const { from, to, subject, body, htmlBody, date, messageId, source } = req.body ?? {}
if (!from || typeof from !== 'string') {
res.status(400).json({ message: 'Missing from address.' }); return
@@ -40,6 +40,7 @@ export function register(app) {
name: fromName || fromEmail,
email: fromEmail,
message: [subject ? `Subject: ${subject}` : '', body ?? ''].filter(Boolean).join('\n\n'),
htmlBody: typeof htmlBody === 'string' && htmlBody.trim() ? htmlBody.trim() : null,
messageType: 'general',
subscribe: false,
archived: false,