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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user